Skip to content

Commit ed8aa77

Browse files
authored
Merge branch 'master' into aligned_alloc_fix
2 parents 9ea52fa + 26a4bf9 commit ed8aa77

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/core/codestream/ojph_params.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,18 @@ namespace ojph {
975975
OJPH_ERROR(0x00050079, "error reading COD segment");
976976
if (file->read(&SPcod.wavelet_trans, 1) != 1)
977977
OJPH_ERROR(0x0005007A, "error reading COD segment");
978+
979+
if (((SPcod.num_decomp & 0x80) == 0 && SPcod.num_decomp > 32)
980+
|| SPcod.block_width > 8
981+
|| SPcod.block_height > 8
982+
|| SPcod.block_width + SPcod.block_height > 8
983+
|| (SPcod.block_style & 0x40) != 0x40
984+
|| (SPcod.block_style & 0xB7) != 0x00)
985+
OJPH_ERROR(0x0005007D, "wrong settings in a COD-SPcod parameter");
986+
if ((SPcod.block_style & 0x40) != 0x40
987+
|| (SPcod.block_style & 0xB7) != 0x00)
988+
OJPH_ERROR(0x0005007E, "unsupported settings in a COD-SPcod parameter");
989+
978990
if (Scod & 1)
979991
for (int i = 0; i <= SPcod.num_decomp; ++i)
980992
if (file->read(&SPcod.precinct_size[i], 1) != 1)
@@ -1021,6 +1033,18 @@ namespace ojph {
10211033
OJPH_ERROR(0x00050128, "error reading COC segment");
10221034
if (file->read(&SPcod.wavelet_trans, 1) != 1)
10231035
OJPH_ERROR(0x00050129, "error reading COC segment");
1036+
1037+
if (((SPcod.num_decomp & 0x80) == 0 && SPcod.num_decomp > 32)
1038+
|| SPcod.block_width > 8
1039+
|| SPcod.block_height > 8
1040+
|| SPcod.block_width + SPcod.block_height > 8
1041+
|| (SPcod.block_style & 0x40) != 0x40
1042+
|| (SPcod.block_style & 0xB7) != 0x00)
1043+
OJPH_ERROR(0x0005012C, "wrong settings in a COC-SPcoc parameter");
1044+
if ((SPcod.block_style & 0x40) != 0x40
1045+
|| (SPcod.block_style & 0xB7) != 0x00)
1046+
OJPH_ERROR(0x0005012D, "unsupported settings in a COC-SPcoc parameter");
1047+
10241048
if (Scod & 1)
10251049
for (int i = 0; i <= get_num_decompositions(); ++i)
10261050
if (file->read(&SPcod.precinct_size[i], 1) != 1)

0 commit comments

Comments
 (0)