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

Floating point exception #139

Closed
strongcourage opened this issue Jul 28, 2019 · 5 comments
Closed

Floating point exception #139

strongcourage opened this issue Jul 28, 2019 · 5 comments

Comments

@strongcourage
Copy link

Hi,

I found a FPE bug on the latest commit fd0c01d on master.
PoC: https://github.com/strongcourage/PoCs/blob/master/libheif_fd0c01d/PoC_fpe_box.cc:62
Command: examples/heif-info $PoC
Valgrind says:

==1112== Process terminating with default action of signal 8 (SIGFPE)
==1112==  Integer divide by zero at address 0x80362AC81
==1112==    at 0x528354: Fraction (box.cc:62)
==1112==    by 0x528354: operator- (box.cc:100)
==1112==    by 0x528354: heif::Box_clap::get_height_rounded() const (box.cc:2263)
==1112==    by 0x48F697: heif::HeifContext::interpret_heif_file() (heif_context.cc:696)
==1112==    by 0x49A40A: heif::HeifContext::read_from_file(char const*) (heif_context.cc:351)
==1112==    by 0x40859F: heif_context_read_from_file (heif.cc:184)
==1112==    by 0x404290: main (heif_info.cc:145)
Floating point exception

Thanks,
Manh Dung

@fancycode
Copy link
Member

@farindk Could you please take a look? The same probably applies to the other XXX_rounded methods in Box_clap.

@farindk
Copy link
Contributor

farindk commented Aug 2, 2019

Thanks for this very strange edge case :-)
Fixed in 5c3dff7

@farindk farindk closed this as completed Aug 2, 2019
@fancycode
Copy link
Member

No longer crashes but now triggers an undefined behavior error (unfortunately not more output):

box.cc:123:43: runtime error: signed integer overflow: -2147483647 * 2 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior box.cc:123:43 in

@farindk
Copy link
Contributor

farindk commented Aug 2, 2019

Let's just limit the resolution of the Fractions to get around all of these numeric edge cases:
2710c93

@fgeek
Copy link

fgeek commented Jul 26, 2021

CVE-2020-19498 has been assigned for this issue.

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

4 participants