Skip to content

fuzzing: negation can result in overflow inside TextView::svtoi #10934

Description

@shukitchan

Fuzzing finds out a potential problem in TextView.

The line in question is https://github.com/apache/trafficserver/blob/master/lib/swoc/src/TextView.cc#L64

zret = -zret

So LONG_MIN is -9223372036854775808 and LONG_MAX is 9223372036854775807
If zret is LONG_MIN, then -zret will result in overflow and it can result in an undefined behavior depending on the system.

The fuzzing finding for this problem is here - https://oss-fuzz.com/testcase-detail/5196561539530752
You can check out the details of this particular finding from ubsan here (under Unary Negation section) - https://wiki.sei.cmu.edu/confluence/display/c/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions