[libbluray-devel] _decode_rle(): always allocate at least one element.

hpi1 git at videolan.org
Sun Dec 4 11:21:09 CET 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Dec  4 12:13:37 2011 +0200| [9bb8beb9333e47525b9d6c754d865acf948d0862] | committer: hpi1

_decode_rle(): always allocate at least one element.
Fixes segfault with "Earth" BD.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=9bb8beb9333e47525b9d6c754d865acf948d0862
---

 src/libbluray/decoders/pg_decode.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/libbluray/decoders/pg_decode.c b/src/libbluray/decoders/pg_decode.c
index 2cafa16..91ca4a6 100644
--- a/src/libbluray/decoders/pg_decode.c
+++ b/src/libbluray/decoders/pg_decode.c
@@ -112,6 +112,9 @@ static int _decode_rle(BITBUFFER *bb, BD_PG_OBJECT *p)
     int num_rle     = 0;
     int rle_size    = p->width * p->height / 4;
 
+    if (rle_size < 1)
+        rle_size = 1;
+
     p->img = realloc(p->img, rle_size * sizeof(BD_PG_RLE_ELEM));
 
     while (!bb_eof(bb)) {



More information about the libbluray-devel mailing list