xiph / vorbis

Reference implementation of the Ogg Vorbis audio format.
BSD 3-Clause "New" or "Revised" License
467 stars 188 forks source link

Avoid SIGFPE when bytespersample is zero #66

Closed petterreinholdtsen closed 4 years ago

petterreinholdtsen commented 4 years ago

0002-Avoid-SIGFPE-when-bytespersample-is-zero.patch from Debian, see https://bugs.debian.org/635906 .

petterreinholdtsen commented 4 years ago

[Ralph Giles]

I think it would be better to return OV_EINVAL here. Neither word nor channels should be zero here.

Do you want to make your own version, or do you want me to change my pull request? I only know what has been used in Debian, and do not really have any opinion on how to properly fix it, but can of course modify the patch based on input. :)

-- Happy hacking Petter Reinholdtsen

rillian commented 4 years ago

I'm happy to have you write a better patch. If you can't figure it out submit what you have and I'll help.

petterreinholdtsen commented 4 years ago

[Ralph Giles]

I'm happy to have you write a better patch. If you can't figure it out submit what you have and I'll help.

OK. Updated patch pushed, this time only checking word and channels for zero, and returning OV_EINVAL if this is the case. I have no idea if this solve the original problem, though. :)

-- Happy hacking Petter Reinholdtsen

petterreinholdtsen commented 4 years ago

[Ralph Giles]

Thanks for writing a patch! I made a few suggestions to make the argument checking more defensive. With those addressed it should be good to merge.

OK, pushed updated patch making sure word is a positive number and channel is 1-255.

-- Happy hacking Petter Reinholdtsen

rillian commented 4 years ago

Merged as 0a4beb1d04f802c48016b11fb939690e24173168. Thanks!