~ubuntu-branches/ubuntu/raring/libav/raring-security

« back to all changes in this revision

Viewing changes to debian/patches/post-0.7.1/0052-smacker-demuxer-handle-possible-av_realloc-failure.patch

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2011-10-01 00:22:07 UTC
  • mfrom: (1.3.8 sid)
  • Revision ID: package-import@ubuntu.com-20111001002207-tnxz39i0rwr5ufy9
Tags: 4:0.7.2-1ubuntu1
* Merge from debian, remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg,
    lame, xvid, x264  (all in universe)
  - not installing into multiarch directories
* This new upstream release has basically merged in all 70 patches that
  are present in 4:0.7.1-7ubuntu2, plus some additional, similarily
  focused ones.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 0b9b3570a3e3f3eff088ee061dbab165ff3eff2f Mon Sep 17 00:00:00 2001
2
 
From: Kostya Shishkov <kostya.shishkov@gmail.com>
3
 
Date: Mon, 12 Sep 2011 09:40:42 +0200
4
 
Subject: [PATCH 52/70] smacker demuxer: handle possible av_realloc() failure.
5
 
 
6
 
Signed-off-by: Anton Khirnov <anton@khirnov.net>
7
 
(cherry picked from commit 47a8589f7bc69d1a29da1dfdfbd0dfa78a9e31fd)
8
 
 
9
 
Signed-off-by: Anton Khirnov <anton@khirnov.net>
10
 
---
11
 
 libavformat/smacker.c |    7 ++++++-
12
 
 1 files changed, 6 insertions(+), 1 deletions(-)
13
 
 
14
 
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
15
 
index db9a02b..135b4ae 100644
16
 
--- a/libavformat/smacker.c
17
 
+++ b/libavformat/smacker.c
18
 
@@ -286,11 +286,16 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
19
 
         for(i = 0; i < 7; i++) {
20
 
             if(flags & 1) {
21
 
                 int size;
22
 
+                uint8_t *tmpbuf;
23
 
+
24
 
                 size = avio_rl32(s->pb) - 4;
25
 
                 frame_size -= size;
26
 
                 frame_size -= 4;
27
 
                 smk->curstream++;
28
 
-                smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
29
 
+                tmpbuf = av_realloc(smk->bufs[smk->curstream], size);
30
 
+                if (!tmpbuf)
31
 
+                    return AVERROR(ENOMEM);
32
 
+                smk->bufs[smk->curstream] = tmpbuf;
33
 
                 smk->buf_sizes[smk->curstream] = size;
34
 
                 ret = avio_read(s->pb, smk->bufs[smk->curstream], size);
35
 
                 if(ret != size)
36
 
1.7.4.1
37