imagecashletter icon indicating copy to clipboard operation
imagecashletter copied to clipboard

images: what to do about length indicator mismatches with ImageData?

Open adamdecaf opened this issue 4 years ago • 1 comments

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.

adamdecaf avatar Aug 01 '20 00:08 adamdecaf

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

adamdecaf avatar Aug 01 '20 00:08 adamdecaf