Avoid negative integer overflow when filesize < io_->tell().

This fixes #791.
This commit is contained in:
Kevin Backhouse
2019-04-30 09:26:18 +01:00
committed by Luis Díaz Más
parent db870755b9
commit caa4e6745a
4 changed files with 52 additions and 12 deletions
+27
View File
@@ -0,0 +1,27 @@
import system_tests
class IntegerOverflowInWebpImageReadMetadata(
metaclass=system_tests.CaseMeta):
"""
Regression test for the bug described in:
https://github.com/Exiv2/exiv2/issues/791
Due to an integer overflow bug (#791), this test triggers a 4GB
memory allocation. So the test will fail with a std::bad_alloc
exception if less than 4GB is available. On Linux, you can use
`ulimit -v 4000000` to reduce the available memory to slightly
less than 4GB.
"""
url = "https://github.com/Exiv2/exiv2/issues/791"
filename = system_tests.path(
"$data_path/issue_791_poc1.webp"
)
commands = ["$exiv2 $filename"]
stdout = [""]
stderr = ["""Exiv2 exception in print action for file $filename:
corrupted image metadata
"""
]
retval = [1]