Skip to content

Commit 2459843

Browse files
Accept null bytes in DPX version
1 parent 50ab86c commit 2459843

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Project/GNU/CLI/test/test1.txt

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Formats/DPX/Flavors/Y_16_FilledA_BE/0000001.dpx pass
212212
Formats/DPX/Flavors/Y_16_Packed_BE/FFmpeg_gray16be.dpx pass
213213
Formats/DPX/Flavors/Y_16_Packed_LE/FFmpeg_gray16le.dpx pass
214214
Formats/DPX/Conformance/0004_OffsetToImageData/0004_OffsetToImageData_000000.dpx fail
215+
Formats/DPX/Conformance/0008_VersionNumber/0008_VersionNumber_null.dpx pass
215216
Formats/DPX/Conformance/0008_VersionNumber/0008_VersionNumber_v.dpx pass
216217
Formats/EXR/Features/Compressed/PXR24/AllHalfValues.exr fail
217218
Formats/EXR/Flavors/RGB_16F/Color_Test_Chart_LogC_400ASA_3200k.cpu.00.exr pass

Source/Lib/Uncompressed/DPX/DPX.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ void dpx::ParseBuffer()
300300
uint64_t VersionNumberBig = Get_B4();
301301
switch (VersionNumberBig)
302302
{
303+
case 0x00000000LL: // Not conform to spec but it exists and it does not hurt
303304
case 0x56312E30LL:
304305
case 0x56322E30LL:
305306
case 0x76312E30LL:
@@ -638,10 +639,12 @@ void dpx::ConformanceCheck()
638639
uint32_t OffsetToImageData = Get_X4();
639640
if (OffsetToImageData < 1664 || OffsetToImageData > Buffer.Size())
640641
Invalid(invalid::OffsetToImageData);
641-
uint64_t VersionNumber = Get_B8() >> 24;
642-
switch (VersionNumber)
642+
uint64_t VersionNumberBig = Get_B4();
643+
switch (VersionNumberBig)
643644
{
644-
case 0x76312E3000LL:
645+
case 0x00000000LL:
646+
case 0x76312E30LL:
647+
case 0x76322E30LL:
645648
Invalid(invalid::VersionNumber);
646649
default:;
647650
}

0 commit comments

Comments
 (0)