< prev index next >

src/os/posix/vm/os_posix.cpp

Print this page
rev 9644 : 8145096: Undefined behaviour in HotSpot
Summary: Fix some integer overflows
Reviewed-by: duke

*** 751,761 **** } strncpy(buffer, "none", size); const struct { ! int i; const char* s; } flaginfo [] = { { SA_NOCLDSTOP, "SA_NOCLDSTOP" }, { SA_ONSTACK, "SA_ONSTACK" }, { SA_RESETHAND, "SA_RESETHAND" }, --- 751,765 ---- } strncpy(buffer, "none", size); const struct { ! // NB: i is an unsigned int here because SA_RESETHAND is on some ! // systems 0x80000000, which is implicitly unsigned. Assignining ! // it to an int field would be an overflow in unsigned-to-signed ! // conversion. ! unsigned int i; const char* s; } flaginfo [] = { { SA_NOCLDSTOP, "SA_NOCLDSTOP" }, { SA_ONSTACK, "SA_ONSTACK" }, { SA_RESETHAND, "SA_RESETHAND" },
< prev index next >