A quick fix:
Code: Select all
diff -EbBu dicom.php.ORIG dicom.php
--- dicom.php.ORIG 2012-01-17 17:24:50.000000000 +0200
+++ dicom.php 2012-01-17 17:26:37.000000000 +0200
@@ -3434,6 +3434,8 @@
$data = fread($this->handle, $offset);
$this->fileSize -= $offset;
$array = unpack($format, $data);
+ if ($array['length'] == 4294967295)
+ $array['length'] = -1;
$length = $array['length'];
if ($length == 0)
continue;
Code: Select all
$data = file_get_contents('testc1.bin');
$array = unpack("vreserved/Vlength/c2data", $data);
var_dump($array);
Code: Select all
$ od -t x1 testc1.bin
0000000 12 34 ff ff ff ff 56 78
0000010
Code: Select all
array(4) {
["reserved"]=>
int(13330)
["length"]=>
int(4294967295)
["data1"]=>
int(86)
["data2"]=>
int(120)
}
Of course some non-specific 32-bit system that turned up behaves as expected:
Code: Select all
array(4) {
["reserved"]=>
int(13330)
["length"]=>
int(-1)
["data1"]=>
int(86)
["data2"]=>
int(120)
}