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

Stricter rules when parsing time values to avoid UBSAN error (backport #3148) #3151

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Feb 4, 2025

This fixes a UBSAN error found by OSS-Fuzz: https://issues.oss-fuzz.com/issues/392928817
The error message is:

/src/exiv2/src/value.cpp:975:43: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself

It happens here:

time_.tzMinute = time_.tzHour < 0 ? -minute : minute;

The integer overflow is harmless, but I have fixed it by making the parsing rules stricter.


This is an automatic backport of pull request #3148 done by Mergify.

Stricter rules when parsing time values to avoid UBSAN error.

(cherry picked from commit e505c9b)
(cherry picked from commit 94e1389)
@kmilos kmilos added this to the v0.28.4 milestone Feb 4, 2025
@kmilos kmilos added the OSS-Fuzz Bug reported by https://google.github.io/oss-fuzz/ label Feb 4, 2025
@kmilos kmilos merged commit 25dcc7f into 0.28.x Feb 4, 2025
62 checks passed
@mergify mergify bot deleted the mergify/bp/0.28.x/pr-3148 branch February 4, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OSS-Fuzz Bug reported by https://google.github.io/oss-fuzz/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants