[libbluray-devel] _decode_rle(): moved oversized image check to decode loop

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


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Dec  4 12:18:53 2011 +0200| [1257bf7445c5678c2e6a627fe57d8fe76e4718a4] | committer: hpi1

_decode_rle(): moved oversized image check to decode loop

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

 src/libbluray/decoders/pg_decode.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/decoders/pg_decode.c b/src/libbluray/decoders/pg_decode.c
index b970d1e..18e1c0a 100644
--- a/src/libbluray/decoders/pg_decode.c
+++ b/src/libbluray/decoders/pg_decode.c
@@ -148,6 +148,11 @@ static int _decode_rle(BITBUFFER *bb, BD_PG_OBJECT *p)
 
         pixels_left -= len;
 
+        if (pixels_left < 0) {
+            BD_DEBUG(DBG_DECODE, "pg_decode_object(): too many pixels (%d)\n", -pixels_left);
+            return 0;
+        }
+
         num_rle++;
         if (num_rle >= rle_size) {
             void *tmp = p->img;
@@ -166,10 +171,6 @@ static int _decode_rle(BITBUFFER *bb, BD_PG_OBJECT *p)
         BD_DEBUG(DBG_DECODE, "pg_decode_object(): missing %d pixels\n", pixels_left);
         return 0;
     }
-    if (pixels_left < 0) {
-        BD_DEBUG(DBG_DECODE, "pg_decode_object(): too many pixels (%d)\n", -pixels_left);
-        return 0;
-    }
 
     return 1;
 }



More information about the libbluray-devel mailing list