Closed anjackson closed 10 years ago
Just had a first look at some of your files. The ones I checked out fall into either one of these 2 categories:
Bit-flipping causes jpylyzer to expect an ICC profile that contans millions of entries. Examples are cc-16-kdu.jp2-killed-1971, cc-16-kdu.jp2-killed-1961, cc-16-kdu.jp2-killed-1937. Analyzing these files with ExifTool gives you sth like this:
Bad ICC_Profile table (67108875 entries)
The solution is to impose a sensible upper limit to the number of entries in an ICC profile.
For all other images, the codestream header field with the number of tiles is corrupted so that it has a very large (milions!) value. Internally jpylyzer creates a dictionary which has an entry for each (expected) tile, and then loops over all them. The result is a seemingly endless loop + excessive memory usage. Examples are cc-16-kdu.jp2-killed-11218 and cc-16-kdu.jp2-killed-10918.
Solution: impose sensible upper limit here as well. Already did a quick test, and this resulted in the secondary problem:
TypeError: cannot serialize 2147483664L (type long)
Solution: add long type to remap function in ETpatch, i.e.:
elif textType in[int,long,float,bool]: textOut=str(remappedValue)
Then there's the endless loop in cc-16-kdu.jp2-killed-22181, will look at that later.
I'll fix this in the next release + I'll also run tests on the full set of files.
Fixed in version 1.10.3. These were actually 3 separate issues:
In case anyone wants to take this kind of tools testing/analysis further, here's a link to my write-up of this technique: Understanding Tools & Formats Via Bitwise Analysis
Some malformed (deliberately bit-flipped) JP2s appear to make jpylyzer hang. e.g. cc-16-kdu.jp2-killed-10918 runs for a long time and then stops, outputting simply 'Killed'.
More interestingly, cc-16-kdu.jp2-killed-22181 appears to cause an infinite loop:
There may be further interesting modes of failure hidden in the other examples I have. I'll see about attaching them... Seems I cannot - so I uploaded the zip of fails here: https://dl.dropbox.com/u/135740/cc-16-kdu-hangs.zip