You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 23, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 23, 2023. It is now read-only.
StringIndexOutOfBoundsException when traceparent is too small #2038
Please answer these questions before submitting a bug report.
What version of OpenCensus are you using?
0.24.0
What JVM are you using (java -version)?
1.8
What did you do?
When using OcHttpServletFilter and the trace id is too short, TraceContextFormat's argument check, will throw a StringIndexOutOfBoundsException which is not caught.
What did you expect to see?
TraceContextFormat throws a SpanContextParseException and does not throw an uncaught exception
What did you see instead?
Uncaught StringIndexOutOfBoundsException at the application level
Additional context
By re-ordering to check length first, this issue should be caught
Activity
dengliming commentedon Jul 26, 2020
You were right. and
traceparent.charAt(TRACE_OPTION_OFFSET - 1) == TRACEPARENT_DELIMITERthis line is duplicated.dengliming commentedon Aug 11, 2020
@alysyk Can you share your reproducing code here?
alysyk commentedon Sep 27, 2021
If traceparent is an empty string, you'll throw a StringIndexOutOfBoundsException.
Bharath-Ganesh commentedon Apr 1, 2023
I see that the aforementioned issue was raised a couple of years back. Can I take this over if it hasn't been resolved yet?
/assign