Skip to content
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

pj_strerrno(): Change check of err value to avoid undefined behavior. #1083

Merged
merged 1 commit into from
Jul 27, 2018

Conversation

schwehr
Copy link
Member

@schwehr schwehr commented Jul 26, 2018

src/pj_strerrno.c:96:20: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
#0 in pj_strerrno proj/src/pj_strerrno.c:96:20
#1 in (anonymous namespace)::ProjErrnoStringTest_ProjErrnos_Test::TestBody() test/unit/proj_errno_string_test.cpp:47:5

ASAN UndefinedBehaviorSanitizer: signed-integer-overflow

Issue revealed by proj_errno_string_test.cpp added in
b87b591 from #1050

src/pj_strerrno.c:96:20: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
    #0 in pj_strerrno proj/src/pj_strerrno.c:96:20
    OSGeo#1 in (anonymous namespace)::ProjErrnoStringTest_ProjErrnos_Test::TestBody() test/unit/proj_errno_string_test.cpp:47:5

ASAN UndefinedBehaviorSanitizer: signed-integer-overflow

Issue revealed by proj_errno_string_test.cpp add in
OSGeo@b87b591
@schwehr schwehr changed the title pj_strerrno(): Change check off err value to avoid undefined behavior. pj_strerrno(): Change check of err value to avoid undefined behavior. Jul 26, 2018
@rouault rouault merged commit 7b7e696 into OSGeo:master Jul 27, 2018
@schwehr schwehr deleted the pj_strerrno-asan branch July 30, 2018 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants