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

« back to all changes in this revision

Viewing changes to debian/patches/post-0.7.1/0029-h264-notice-memory-allocation-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 59a22afa0b50b9037133a7bc26bdc5023e7e1df9 Mon Sep 17 00:00:00 2001
2
 
From: Dustin Brody <libav@parsoma.net>
3
 
Date: Thu, 11 Aug 2011 08:57:58 -0400
4
 
Subject: [PATCH 29/70] h264: notice memory allocation failure
5
 
 
6
 
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
7
 
(cherry picked from commit bac3ab13ea6a9dd8853e79ef3eacf51d234c8774)
8
 
 
9
 
Signed-off-by: Anton Khirnov <anton@khirnov.net>
10
 
---
11
 
 libavcodec/h264.c |   10 ++++++++--
12
 
 1 files changed, 8 insertions(+), 2 deletions(-)
13
 
 
14
 
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
15
 
index 2c000a3..99be210 100644
16
 
--- a/libavcodec/h264.c
17
 
+++ b/libavcodec/h264.c
18
 
@@ -1165,7 +1165,10 @@ static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContex
19
 
         memcpy(&h->s + 1, &h1->s + 1, sizeof(H264Context) - sizeof(MpegEncContext)); //copy all fields after MpegEnc
20
 
         memset(h->sps_buffers, 0, sizeof(h->sps_buffers));
21
 
         memset(h->pps_buffers, 0, sizeof(h->pps_buffers));
22
 
-        ff_h264_alloc_tables(h);
23
 
+        if (ff_h264_alloc_tables(h) < 0) {
24
 
+            av_log(dst, AV_LOG_ERROR, "Could not allocate memory for h264\n");
25
 
+            return AVERROR(ENOMEM);
26
 
+        }
27
 
         context_init(h);
28
 
 
29
 
         for(i=0; i<2; i++){
30
 
@@ -2635,7 +2638,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
31
 
         h->prev_interlaced_frame = 1;
32
 
 
33
 
         init_scan_tables(h);
34
 
-        ff_h264_alloc_tables(h);
35
 
+        if (ff_h264_alloc_tables(h) < 0) {
36
 
+            av_log(h->s.avctx, AV_LOG_ERROR, "Could not allocate memory for h264\n");
37
 
+            return AVERROR(ENOMEM);
38
 
+        }
39
 
 
40
 
         if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_SLICE)) {
41
 
             if (context_init(h) < 0) {
42
 
1.7.4.1
43