[libbluray-devel] rle: stop at error

hpi1 git at videolan.org
Sun Aug 7 21:08:26 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Aug  7 22:07:40 2016 +0300| [665add76cfdd755b08156e9760fb173ad5423349] | committer: hpi1

rle: stop at error

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

 src/libbluray/decoders/rle.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/decoders/rle.c b/src/libbluray/decoders/rle.c
index 1439565..185072e 100644
--- a/src/libbluray/decoders/rle.c
+++ b/src/libbluray/decoders/rle.c
@@ -33,6 +33,9 @@ static int _rle_ensure_size(RLE_ENC *p)
 {
     if (BD_UNLIKELY(!p->free_elem)) {
         BD_PG_RLE_ELEM *start = rle_get(p);
+        if (p->error) {
+            return -1;
+        }
         /* realloc to 2x */
         void *tmp = refcnt_realloc(start, p->num_elem * 2 * sizeof(BD_PG_RLE_ELEM));
         if (!tmp) {
@@ -181,7 +184,7 @@ int rle_add_bite(RLE_ENC *p, uint8_t color, int len)
         p->elem->len += len;
     } else {
         if (BD_LIKELY(p->elem->len)) {
-            if (BD_UNLIKELY(!_rle_grow(p))) {
+            if (BD_UNLIKELY(_rle_grow(p) < 0)) {
                 return -1;
             }
         }



More information about the libbluray-devel mailing list