Skip to content

std.compress.xz: Avoid possible integer overflow in a few places #14521

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

Closed
wants to merge 1 commit into from

Conversation

squeek502
Copy link
Collaborator

Closes #14500

Note: The test cases here could definitely be improved by constructing a valid xz input that would otherwise trigger the overflows. That way, the test cases would actually be testing something in all release modes.

@@ -217,7 +217,7 @@ pub fn Decoder(comptime ReaderType: type) type {
if (status == 1)
try self.accum.reset(self.allocator);

const size = try packed_reader.readIntBig(u16) + 1;
const size = @as(u17, try packed_reader.readIntBig(u16)) + 1;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this will be superseded by/conflict with #14518 (comment)

Let me know if it'd be better to defer this fix to that PR

@squeek502
Copy link
Collaborator Author

squeek502 commented Feb 9, 2023

Closing since all of these changes are now included in #14518. Will re-open this if #14518 is not merged for whatever reason.

@squeek502 squeek502 closed this Feb 9, 2023
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

Successfully merging this pull request may close these issues.

std.compress.xz: Integer overflows found via fuzzing
1 participant