-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reporting undefined behaviors (integer overflow and nullptr dereference) #4299
Comments
Isn't it normal that API functions will do weird things or even crash if they are called with illegal values? Would you expect that |
At least for |
I don't think there is an integer overflow. You call the function with a negative argument which is not a valid PSM value, and the function compares this |
|
Hi! While testing with Tesseract APIs we spotted some issues that might lead to undefined behaviors.
An API call sequence:
would crash at
tesseract/src/api/baseapi.cpp
Line 1837 in 46b9904
under address sanitizer due to not checking if
wordstr
is a valid pointer.Also, it reaches there due to an integer overflow in:
tesseract/include/tesseract/publictypes.h
Lines 186 to 188 in 46b9904
if the second argument
PageSegMode
inTessBaseAPIAdaptToWordStr
is negative and makesPSM_OSD_ENABLED
wrongly returntrue
.The text was updated successfully, but these errors were encountered: