From ca402f32e392590a81a1381dab41c4f9c2c2f98a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 12 Apr 2011 17:44:20 +0200 Subject: handle malloc failures in ff_get_wav_header ff_get_wav_header is reading data from a WAVE file and then uses it (without validation) to malloc a buffer. It then proceeded to read data into the buffer, without verifying that the allocation succeeded. To address this, change ff_get_wav_header to return an error if allocation failed, and adapted all calling code to handle that error. Signed-off-by: Luca Barbato --- libavformat/riff.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavformat/riff.h') diff --git a/libavformat/riff.h b/libavformat/riff.h index 174301264f..a2fa8b7b1c 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -45,7 +45,7 @@ int ff_get_bmp_header(AVIOContext *pb, AVStream *st); void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc); enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps); -void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size); +int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size); extern const AVCodecTag ff_codec_bmp_tags[]; extern const AVCodecTag ff_codec_wav_tags[]; -- cgit v1.2.3