Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect segment length when there is entropy #10

Open
mauricefisher64 opened this issue Jun 5, 2023 · 0 comments
Open

Incorrect segment length when there is entropy #10

mauricefisher64 opened this issue Jun 5, 2023 · 0 comments

Comments

@mauricefisher64
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant