Skip to content

Commit e884a09

Browse files
Merge pull request from GHSA-hrw9-ggg3-3r4r
Fix integer overflow in BmffImage::brotliUncompress
2 parents 8fd2dfb + d8f82d5 commit e884a09

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

src/bmffimage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void BmffImage::brotliUncompress(const byte* compressedBuf, size_t compressedBuf
212212
uncompressedLen *= 2;
213213
// DoS protection - can't be bigger than 128k
214214
if (uncompressedLen > 131072) {
215-
if (++dos > 1)
215+
if (++dos > 1 || total_out > 131072)
216216
break;
217217
uncompressedLen = 131072;
218218
}
64 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from system_tests import CaseMeta, path
4+
5+
class BrotliUncompressOutOfBoundsWrite(metaclass=CaseMeta):
6+
"""
7+
Regression test for the bug described in:
8+
https://github.com/Exiv2/exiv2/security/advisories/GHSA-hrw9-ggg3-3r4r
9+
"""
10+
url = "https://github.com/Exiv2/exiv2/security/advisories/GHSA-hrw9-ggg3-3r4r"
11+
12+
filename = path("$data_path/issue_ghsa_hrw9_ggg3_3r4r_poc.jpg")
13+
commands = ["$exiv2 $filename"]
14+
stdout = [""]
15+
stderr = [
16+
"""Exiv2 exception in print action for file $filename:
17+
$kerFailedToReadImageData
18+
"""]
19+
retval = [1]

tests/regression_tests/test_regression_allfiles.py

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def get_valid_files(data_dir):
116116
"issue_ghsa_583f_w9pm_99r2_poc.jp2",
117117
"issue_ghsa_7569_phvm_vwc2_poc.jp2",
118118
"issue_ghsa_mxw9_qx4c_6m8v_poc.jp2",
119+
"issue_ghsa_hrw9_ggg3_3r4r_poc.jpg",
119120
"pocIssue283.jpg",
120121
"poc_1522.jp2",
121122
"xmpsdk.xmp",

0 commit comments

Comments
 (0)