imagecashletter
imagecashletter copied to clipboard
images: what to do about length indicator mismatches with ImageData?
What were you trying to do?
A few files have been reported where a decoding step was needed prior to parsing. This decoding seems to change the bytes we need to read for ImageData
, but the LengthImageData
field isn't updated as part of this decoding. Thus the Parse
method won't read past the array and returns without populating any ImageData
.
The images appear empty / null, but we can read the rest of the line and everything works out.
What did you expect to see? Images are read properly even through an extra decode step prior to parsing.
I need to review the spec, but is there any problem with reading the rest of the line into ImageData
? Sure we should limit it to 10k characters or something, but is this check too strict for real-world files?
In specific it's this length check:
https://github.com/moov-io/imagecashletter/blob/v0.4.3/imageViewData.go#L206-L211