On 08/24/2014 12:12 AM, Nidhi Makhijani wrote:
---
  libavformat/oggparsespeex.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index b2779e7..43d687a 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -47,6 +47,8 @@ static int speex_header(AVFormatContext *s, int idx) {
if (!spxp) {
          spxp = av_mallocz(sizeof(*spxp));
+        if (!spxp)
+            return AVERROR(ENOMEM);
          os->private = spxp;
      }
@@ -75,6 +77,10 @@ static int speex_header(AVFormatContext *s, int idx) {
          st->codec->extradata_size = os->psize;
          st->codec->extradata = av_malloc(st->codec->extradata_size
                                           + FF_INPUT_BUFFER_PADDING_SIZE);
+        if (!st->codec->extradata) {
+            st->codec->extradata_size = 0;
+            return AVERROR(ENOMEM);
+        }
          memcpy(st->codec->extradata, p, st->codec->extradata_size);
avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);

The patch itself looks good. Unfortunately the ogg demuxer is not currently checking the return value of the header() function for error, so that needs to be handled as well.

-Justin

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to