OSDN Git Service

Merge commit 'ed9245dba83f9add60f55718b537b0af2105c60e'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 13 Oct 2013 06:43:50 +0000 (08:43 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 13 Oct 2013 06:53:47 +0000 (08:53 +0200)
* commit 'ed9245dba83f9add60f55718b537b0af2105c60e':
  oggparsevorbis: check allocations

Conflicts:
libavformat/oggparsevorbis.c

See: 033f1644b59abd755bb529afa5db394d18d9c30b
See: 84aea80f7824c23b4cbf101f03e2b5b418a79d80
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/oggparsevorbis.c

@@@ -193,20 -172,17 +193,20 @@@ struct oggvorbis_private 
      int final_duration;
  };
  
- static unsigned int fixup_vorbis_headers(AVFormatContext *as,
-                                          struct oggvorbis_private *priv,
-                                          uint8_t **buf)
+ static int fixup_vorbis_headers(AVFormatContext *as,
+                                 struct oggvorbis_private *priv,
+                                 uint8_t **buf)
  {
      int i, offset, len, err;
 +    int buf_len;
      unsigned char *ptr;
  
      len = priv->len[0] + priv->len[1] + priv->len[2];
 -    ptr = *buf = av_mallocz(len + len / 255 + 64);
 +    buf_len = len + len / 255 + 64;
 +    ptr = *buf = av_realloc(NULL, buf_len);
-     if (!*buf)
-         return 0;
+     if (!ptr)
+         return AVERROR(ENOMEM);
 +    memset(*buf, '\0', buf_len);
  
      ptr[0]  = 2;
      offset  = 1;