Tweak AdditionOverflowInLoaderExifJpeg for 32bit unsigned char OSes
authorPino Toscano <pino@debian.org>
Mon, 30 Sep 2024 23:40:44 +0000 (23:40 +0000)
committerPeter Michael Green <plugwash@raspbian.org>
Mon, 30 Sep 2024 23:40:44 +0000 (23:40 +0000)
Last-Update: 2023-07-16
Forwarded: not-needed

AdditionOverflowInLoaderExifJpeg expects an overflow to happen on 32bit
architectures; due to the way LoaderExifJpeg & StringValueBase work and the
test data is fabricated, the overflow happens only architectures with signed
char.

Tweak AdditionOverflowInLoaderExifJpeg to account for this, by not expecting an
overflow in case the architecture has unsigned char (e.g. ARM and POWER).

For more discussion and notes, see: https://github.com/Exiv2/exiv2/issues/933

Gbp-Pq: Name tests-overflow-skip-unsigned-char-23bit.diff

tests/bugfixes/github/test_CVE_2018_12265.py

index 50d74b598e113ac9bac827a5a7171fd55f78a9b4..e98ddb88ad6e2386e1fb49558276641a35e0c217 100644 (file)
@@ -1,5 +1,7 @@
 # -*- coding: utf-8 -*-
 
+import platform
+
 import system_tests
 
 class AdditionOverflowInLoaderExifJpeg(metaclass=system_tests.CaseMeta):
@@ -17,6 +19,6 @@ class AdditionOverflowInLoaderExifJpeg(metaclass=system_tests.CaseMeta):
 Warning: Directory Image, entry 0x0201: Strip 0 is outside of the data area; ignored.
 Warning: Directory Image, entry 0x0201: Strip 7 is outside of the data area; ignored.
 """ +
-        ("" if system_tests.BT.Config.is_64bit else "Uncaught exception: Overflow in addition\n")
+        ("" if system_tests.BT.Config.is_64bit or any(i for i in ["arm", "ppc"] if i in platform.uname().machine) else "Uncaught exception: Overflow in addition\n")
     ]
-    retval = [0 if system_tests.BT.Config.is_64bit else 1]
+    retval = [0 if system_tests.BT.Config.is_64bit or any(i for i in ["arm", "ppc"] if i in platform.uname().machine) else 1]