summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2015-01-20 14:27:20 +0000
committerAntonin Descampe <antonin@gmail.com>2015-01-20 14:27:20 +0000
commit4c0ed028069057b1bf2b2920f04128228d69b61c (patch)
tree0ac5de9355009845573c809aeb88a0969d90d644 /src/lib
parent5d00b719f4b93b1445e6fb4c766b9a9883c57949 (diff)
[trunk] checks for JP2 signature and file type boxes more carefully
Update issue 430
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/openjp2/jp2.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c
index 6d7a24e1..aafbe199 100644
--- a/src/lib/openjp2/jp2.c
+++ b/src/lib/openjp2/jp2.c
@@ -2066,6 +2066,16 @@ OPJ_BOOL opj_jp2_read_header_procedure( opj_jp2_t *jp2,
}
}
else {
+ if (!(jp2->jp2_state & JP2_STATE_SIGNATURE)) {
+ opj_event_msg(p_manager, EVT_ERROR, "Malformed JP2 file format: first box must be JPEG 2000 signature box\n");
+ opj_free(l_current_data);
+ return OPJ_FALSE;
+ }
+ if (!(jp2->jp2_state & JP2_STATE_FILE_TYPE)) {
+ opj_event_msg(p_manager, EVT_ERROR, "Malformed JP2 file format: second box must be file type box\n");
+ opj_free(l_current_data);
+ return OPJ_FALSE;
+ }
jp2->jp2_state |= JP2_STATE_UNKNOWN;
if (opj_stream_skip(stream,l_current_data_size,p_manager) != l_current_data_size) {
opj_event_msg(p_manager, EVT_ERROR, "Problem with skipping JPEG2000 box, stream error\n");