summaryrefslogtreecommitdiff
path: root/third_party/libopenjpeg20/0024-l_marker_size_check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libopenjpeg20/0024-l_marker_size_check.patch')
-rw-r--r--third_party/libopenjpeg20/0024-l_marker_size_check.patch15
1 files changed, 15 insertions, 0 deletions
diff --git a/third_party/libopenjpeg20/0024-l_marker_size_check.patch b/third_party/libopenjpeg20/0024-l_marker_size_check.patch
new file mode 100644
index 0000000000..cb020c9d0e
--- /dev/null
+++ b/third_party/libopenjpeg20/0024-l_marker_size_check.patch
@@ -0,0 +1,15 @@
+diff --git a/third_party/libopenjpeg20/j2k.c b/third_party/libopenjpeg20/j2k.c
+index 45187e8e6..5de89cf0e 100644
+--- a/third_party/libopenjpeg20/j2k.c
++++ b/third_party/libopenjpeg20/j2k.c
+@@ -7195,6 +7195,10 @@ static OPJ_BOOL opj_j2k_read_header_procedure( opj_j2k_t *p_j2k,
+
+ /* read 2 bytes as the marker size */
+ opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,&l_marker_size,2);
++ if (l_marker_size < 2) {
++ opj_event_msg(p_manager, EVT_ERROR, "Invalid marker size\n");
++ return OPJ_FALSE;
++ }
+ l_marker_size -= 2; /* Subtract the size of the marker ID already read */
+
+ /* Check if the marker size is compatible with the header data size */