Avoid negative integer overflow when iccOffset > chunkLength.

This fixes #790.
This commit is contained in:
Kevin Backhouse
2019-04-25 21:31:50 +01:00
committed by Luis Díaz Más
parent fe3f3248dd
commit 6fa2e31206
3 changed files with 29 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import system_tests
class IntegerOverflowInPngImageReadMetadata(
metaclass=system_tests.CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/issues/790
Due to an integer overflow bug (#790), this test triggers an 8GB
memory allocation. So the test will fail with a std::bad_alloc
exception if less than 8GB is available. On Linux, you can use
`ulimit -v 8000000` to reduce the available memory to slightly
less than 8GB.
"""
url = "https://github.com/Exiv2/exiv2/issues/790"
filename = system_tests.path(
"$data_path/issue_790_poc2.png"
)
commands = ["$exiv2 $filename"]
stdout = [""]
stderr = ["""Exiv2 exception in print action for file $filename:
corrupted image metadata
"""
]
retval = [1]