Below is a patch for imlib2 TGA image loader, which fixes a regression
in loading of RLE-encoded files. This patch is based on the current
git head of the imlib2 repo.

Additionally, I could not find an entry for imlib2 in Phabricator,
so I am unable to create a patch using Arcanist.

Cheers,
Ralph


commit 32ca1bdd57f35de08075096f3148d13582545731
Author: Ralph Siemsen <ral...@netwinder.org>
Date:   Tue Apr 17 14:51:03 2018 -0400

    loader_tga: fix regression in RLE raw byte handling
    
    Commit 6ef51ec4cd6e9c8755a377699938c59757258f8d added some cleanup
    logic, however it introduced an off-by-one bug for raw bytes in RLE.
    It looks like a copy'n'paste problem:
    - the check on line 426 is correct, however
    - the check on line 481 has an erronous "+ 1"
    In the second case, "bufptr" has already been incremented, so the
    extra "+ 1" is not needed.
    
    This bug causes some legitimate TGA files to fail to load, on the
    very last pixel...

diff --git a/src/modules/loaders/loader_tga.c b/src/modules/loaders/loader_tga.c
index 988b6ce..fe6165d 100644
--- a/src/modules/loaders/loader_tga.c
+++ b/src/modules/loaders/loader_tga.c
@@ -488,7 +488,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
 
                        for (i = 0; (i < count) && (dataptr < final_pixel); i++)
                          {
-                            if ((bufptr + 1 + (bpp / 8)) > bufend)
+                            if ((bufptr + bpp / 8) > bufend)
                               {
                                  munmap(seg, ss.st_size);
                                  free(im->data);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to