libyami
libyami copied to clipboard
Integer overflow for 32bit build in gtest
Building current git on fedora 27 i686 and armv7hl with gtest fails with:
g++ -DHAVE_CONFIG_H -I. -I.. -I../interface -I../gtestsrc/gtest/include -g -O2 -Wall -Wno-unused-function -Wno-cpp -Wno-missing-braces -Werror -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=generic -fasynchronous-unwind-tables -c -o unittest-utils_unittest.o test -f 'utils_unittest.cpp' || echo './'
utils_unittest.cpp
make[2]: Leaving directory '/builddir/build/BUILD/libyami-40fa32e79f12c3c85c360532be00b7e4f9a35920/common'
utils_unittest.cpp: In member function 'virtual void UtilsTest_guessResolutionOverflow_Test::TestBody()':
utils_unittest.cpp:134:54: error: integer overflow in expression [-Werror=overflow]
sstream << long(std::numeric_limits
@kwizart , thanks for reporting this, @wangzj0601 , could you help to check?
@wangzj0601 ,any update on this?
@xuguangxin, I am building the environment now.
OK, long
and int
are the same size on 32-bit compiler... thus, coercing the type to long long
to clear the error and get the test to compile is not enough. The test will still fail when executed... and clearly it exposes another underlying flaw in the guessResolution
function.
FYI, there are many more compiler errors on 32-bit builds beyond this (try enabling all encoders, decoders and debug and you'll see). Clearly, no one had 32-bit support in mind when developing this library.