[FFmpeg-devel] [PATCH] 8svx: ensure that packet size is multiple of channels.
Michael Niedermayer
michaelni at gmx.at
Wed Aug 1 00:15:17 CEST 2012
On Tue, Jul 31, 2012 at 11:55:32PM +0200, Nicolas George wrote:
> Fix an assert failure with packets of invalid size.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavcodec/8svx.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
> index e89b252..37170a8 100644
> --- a/libavcodec/8svx.c
> +++ b/libavcodec/8svx.c
> @@ -112,9 +112,14 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
> /* decode and interleave the first packet */
> if (!esc->samples && avpkt) {
> uint8_t *deinterleaved_samples, *p = NULL;
> + int packet_size = avpkt->size;
>
> + if (packet_size % avctx->channels) {
> + av_log(avctx, AV_LOG_WARNING, "Packet with odd size, ignoring last byte\n");
> + packet_size -= packet_size % avctx->channels;
> + }
> esc->samples_size = !esc->table ?
> - avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2;
> + packet_size : avctx->channels + (packet_size-avctx->channels) * 2;
if size < channels then samples_size could become negative
otherwise LGTM
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120801/448ced41/attachment.asc>
More information about the ffmpeg-devel
mailing list