Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Integer overflow for 32bit build in gtest #833

Open
kwizart opened this issue Mar 8, 2018 · 4 comments
Open

Integer overflow for 32bit build in gtest #833

kwizart opened this issue Mar 8, 2018 · 4 comments
Assignees

Comments

@kwizart
Copy link

kwizart commented Mar 8, 2018

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::max()) * 2 + 3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
utils_unittest.cpp:136:54: error: integer overflow in expression [-Werror=overflow]
<< long(std::numeric_limits::max()) * 3 + 2;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
cc1plus: all warnings being treated as errors

@xuguangxin
Copy link
Contributor

@kwizart , thanks for reporting this, @wangzj0601 , could you help to check?

@xuguangxin
Copy link
Contributor

@wangzj0601 ,any update on this?

@wangzj0601
Copy link
Contributor

@xuguangxin, I am building the environment now.

wangzj0601 added a commit to wangzj0601/libyami that referenced this issue Mar 23, 2018
@uartie
Copy link
Contributor

uartie commented Mar 23, 2018

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.

wangzj0601 added a commit to wangzj0601/libyami that referenced this issue Mar 28, 2018
wangzj0601 added a commit to wangzj0601/libyami that referenced this issue Mar 28, 2018
wangzj0601 added a commit to wangzj0601/libyami that referenced this issue May 4, 2018
wangzj0601 added a commit to wangzj0601/libyami that referenced this issue May 10, 2018
xuguangxin pushed a commit to xuguangxin/libyami that referenced this issue Jul 2, 2018
xuguangxin pushed a commit that referenced this issue Aug 24, 2018
xuguangxin pushed a commit to xuguangxin/libyami that referenced this issue Nov 15, 2018
clrpackages pushed a commit to clearlinux-pkgs/libyami that referenced this issue Nov 19, 2018
….3.1

Anuj Mittal (1):
      Makefile.am: point to build dir for generated headers

Gamester17 (1):
      Amendments to README.md

Jay Sorg (1):
      use env var for device file to open

U. Artie Eoff (4):
      encode/jpeg: allow encode quality to be configured
      encode/unittest: add simple quality set/get test for jpeg
      vaapi: VAEntrypointFEI not defined until libva-2.0
      vpp/scaler: rotation not available until VAAPI 1.1.0

Xu Guangxin (16):
      travis: fix the build issue since we move from 01org to intel
      add Reporting a security issue
      Revert "com_unittest: modify over range resolution"
      common: fix guessResolutionOverflow fail
      common: fix typo for STATE_WDITH
      common: add RGB565 support
      unittest: common, add test for RGB16
      unittest: common, add support for RGBA, BGRA, ARGB, ABGR
      unittest: common, add support for R210(RGB 10 bits)
      configure.ac: bump API version to 0.5.4 for RGB565 and RGB 10bits
      v4l2: fix compile warnning for V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
      egl: protect YamiV4L2_UseEglImage with __ENABLE_EGL__
      interface: remove extern C for decoder,encoder,vpp
      vp8enc: make some deconsturctor virtulized
      android: re-enable android build
      configure.ac: bump API version to 0.5.5 for VIDEO_DECODE_BUFFER_FLAG

XuGuangxin (4):
      common: add XRGB, ARGB, XBGR, ABGR support
      common: add RGB 10 bits support
      h264dec: fix low lantecy mode
      h264, h265: add VIDEO_DECODE_BUFFER_FLAG_FRAME_END to inidicate frame end

Yu, Linda (1):
      v4l2_decode:alloc 1 frame for generating thumbnail

Zhanjun, Wang (6):
      fix bug intel/libyami#830
      fix non initialization and remove potential memory leak for decoding unit tests.
      Add flags for SDL signoff called SDL325 - Compile With Defenses Enabled
      unittest: decoder, enable lowlatency test
      fix bug intel/libyami#833
      libyami-1.3.1 release

dongping wu (1):
      yamivpp: add rotation function for vpp

jkyu (1):
      configure.ac: bump version to 1.3.0

root (1):
      fix memset issue when compile with enabling gtest

Signed-off-by: Daniel Charles <[email protected]>
clrpackages pushed a commit to clearlinux-pkgs/libyami that referenced this issue Apr 22, 2022
….3.1

Anuj Mittal (1):
      Makefile.am: point to build dir for generated headers

Gamester17 (1):
      Amendments to README.md

Jay Sorg (1):
      use env var for device file to open

U. Artie Eoff (4):
      encode/jpeg: allow encode quality to be configured
      encode/unittest: add simple quality set/get test for jpeg
      vaapi: VAEntrypointFEI not defined until libva-2.0
      vpp/scaler: rotation not available until VAAPI 1.1.0

Xu Guangxin (16):
      travis: fix the build issue since we move from 01org to intel
      add Reporting a security issue
      Revert "com_unittest: modify over range resolution"
      common: fix guessResolutionOverflow fail
      common: fix typo for STATE_WDITH
      common: add RGB565 support
      unittest: common, add test for RGB16
      unittest: common, add support for RGBA, BGRA, ARGB, ABGR
      unittest: common, add support for R210(RGB 10 bits)
      configure.ac: bump API version to 0.5.4 for RGB565 and RGB 10bits
      v4l2: fix compile warnning for V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
      egl: protect YamiV4L2_UseEglImage with __ENABLE_EGL__
      interface: remove extern C for decoder,encoder,vpp
      vp8enc: make some deconsturctor virtulized
      android: re-enable android build
      configure.ac: bump API version to 0.5.5 for VIDEO_DECODE_BUFFER_FLAG

XuGuangxin (4):
      common: add XRGB, ARGB, XBGR, ABGR support
      common: add RGB 10 bits support
      h264dec: fix low lantecy mode
      h264, h265: add VIDEO_DECODE_BUFFER_FLAG_FRAME_END to inidicate frame end

Yu, Linda (1):
      v4l2_decode:alloc 1 frame for generating thumbnail

Zhanjun, Wang (6):
      fix bug intel/libyami#830
      fix non initialization and remove potential memory leak for decoding unit tests.
      Add flags for SDL signoff called SDL325 - Compile With Defenses Enabled
      unittest: decoder, enable lowlatency test
      fix bug intel/libyami#833
      libyami-1.3.1 release

dongping wu (1):
      yamivpp: add rotation function for vpp

jkyu (1):
      configure.ac: bump version to 1.3.0

root (1):
      fix memset issue when compile with enabling gtest

Signed-off-by: Daniel Charles <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants