Incorrect segment length when there is entropy
mauricefisher64 opened this issue · 0 comments
mauricefisher64 commented
The segment length for those containing entropy (SOS) is not correct. The length is being calculated as from the beginning of the segment to the end of the file as shown here from jpeg/image.rs in the function from_bytes
let segment = JpegSegment::from_bytes(marker, &mut b)?;
let has_entropy = segment.has_entropy();
segments.push(segment);
if has_entropy {
break;
}
So for the simple case this will also include the EOI in the size calculation. If there are other segments after the SOS they would also be included in this value.