[FFmpeg-devel] [PATCH] s302m: fix arithmetic exception
Michael Niedermayer
michaelni at gmx.at
Fri Jun 26 01:27:49 CEST 2015
On Fri, Jun 26, 2015 at 12:05:09AM +0200, Andreas Cadhalpun wrote:
> If 'buf_size * 8' is smaller than 'avctx->channels *
> (avctx->bits_per_raw_sample + 4)' it resulted in a division by zero.
>
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
> libavcodec/s302m.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
> index 5cf9eb5..36c8e7c 100644
> --- a/libavcodec/s302m.c
> +++ b/libavcodec/s302m.c
> @@ -86,9 +86,9 @@ static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf,
> avctx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK | AV_CH_LAYOUT_STEREO_DOWNMIX;
> }
> avctx->bit_rate = 48000 * avctx->channels * (avctx->bits_per_raw_sample + 4) +
> - 32 * (48000 / (buf_size * 8 /
> - (avctx->channels *
> - (avctx->bits_per_raw_sample + 4))));
> + 32 * (48000 * avctx->channels
> + * (avctx->bits_per_raw_sample + 4))
> + / (buf_size * 8);
i dont think the new code matches the nb_samples vs. buf_size vs.
samplerate of s302m_decode_frame()
maybe the nb_samples calculation could be factored out and used for
bitrate computation too
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150626/8f5fe92d/attachment.asc>
More information about the ffmpeg-devel
mailing list