kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=4fc4a6ad77f5bd587daf6178e02edbfacfc8b06e

commit 4fc4a6ad77f5bd587daf6178e02edbfacfc8b06e
Author: Ralph Siemsen <[email protected]>
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...
---
 src/modules/loaders/loader_tga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);

-- 


Reply via email to