Gitweb links:

...log 
http://git.netsurf-browser.org/libnsbmp.git/shortlog/6454650532ae2f109fb668f716317fdda3ee7d20
...commit 
http://git.netsurf-browser.org/libnsbmp.git/commit/6454650532ae2f109fb668f716317fdda3ee7d20
...tree 
http://git.netsurf-browser.org/libnsbmp.git/tree/6454650532ae2f109fb668f716317fdda3ee7d20

The branch, master has been updated
       via  6454650532ae2f109fb668f716317fdda3ee7d20 (commit)
      from  4fd92297e0a144881f37ffdb1c19fab6b0d3e47d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libnsbmp.git/commit/?id=6454650532ae2f109fb668f716317fdda3ee7d20
commit 6454650532ae2f109fb668f716317fdda3ee7d20
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Decode: Account for row padding at end of row, rather than start.

diff --git a/src/libnsbmp.c b/src/libnsbmp.c
index c03d34b..dc18a50 100644
--- a/src/libnsbmp.c
+++ b/src/libnsbmp.c
@@ -529,8 +529,6 @@ static bmp_result bmp_decode_rgb32(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data++;
                 if ((data + (4 * bmp->width)) > end)
                         return BMP_INSUFFICIENT_DATA;
                 if (bmp->reversed)
@@ -566,6 +564,8 @@ static bmp_result bmp_decode_rgb32(bmp_image *bmp, uint8_t 
**start, int bytes)
                                 scanline[x] = read_uint32((uint8_t 
*)&scanline[x],0);
                         }
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data++;
         }
         *start = data;
         return BMP_OK;
@@ -615,10 +615,6 @@ static bmp_result bmp_decode_rgb24(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3)) {
-                        data++;
-                }
-
                 if ((data + (3 * bmp->width)) > end) {
                         return BMP_INSUFFICIENT_DATA;
                 }
@@ -640,6 +636,9 @@ static bmp_result bmp_decode_rgb24(bmp_image *bmp, uint8_t 
**start, int bytes)
                         scanline[x] = read_uint32((uint8_t *)&scanline[x],0);
                 }
 
+                while (addr != (((intptr_t)data) & 3)) {
+                        data++;
+                }
         }
         *start = data;
         return BMP_OK;
@@ -683,8 +682,6 @@ static bmp_result bmp_decode_rgb16(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data += 2;
                 if ((data + (2 * bmp->width)) > end)
                         return BMP_INSUFFICIENT_DATA;
                 if (bmp->reversed)
@@ -726,6 +723,8 @@ static bmp_result bmp_decode_rgb16(bmp_image *bmp, uint8_t 
**start, int bytes)
                                 scanline[x] = read_uint32((uint8_t 
*)&scanline[x],0);
                         }
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data += 2;
         }
         *start = data;
         return BMP_OK;
@@ -775,8 +774,6 @@ static bmp_result bmp_decode_rgb(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data++;
                 bit = 8;
                 if ((data + (bmp->width / ppb)) > end)
                         return BMP_INSUFFICIENT_DATA;
@@ -800,6 +797,8 @@ static bmp_result bmp_decode_rgb(bmp_image *bmp, uint8_t 
**start, int bytes)
                                 }
                         }
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data++;
         }
         *start = data;
         return BMP_OK;
@@ -828,11 +827,10 @@ static bmp_result bmp_decode_mask(bmp_image *bmp, uint8_t 
*data, int bytes)
                 return BMP_INSUFFICIENT_MEMORY;
         bottom = top + (uint64_t)swidth * (bmp->height - 1);
         end = data + bytes;
+
         addr = ((intptr_t)data) & 3;
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data++;
                 if ((data + (bmp->width >> 3)) > end)
                         return BMP_INSUFFICIENT_DATA;
                 scanline = (void *)(bottom - (y * swidth));
@@ -848,6 +846,8 @@ static bmp_result bmp_decode_mask(bmp_image *bmp, uint8_t 
*data, int bytes)
                         scanline[x] = read_uint32((uint8_t *)&scanline[x], 0);
                         cur_byte = cur_byte << 1;
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data++;
         }
         return BMP_OK;
 }


-----------------------------------------------------------------------

Summary of changes:
 src/libnsbmp.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/libnsbmp.c b/src/libnsbmp.c
index c03d34b..dc18a50 100644
--- a/src/libnsbmp.c
+++ b/src/libnsbmp.c
@@ -529,8 +529,6 @@ static bmp_result bmp_decode_rgb32(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data++;
                 if ((data + (4 * bmp->width)) > end)
                         return BMP_INSUFFICIENT_DATA;
                 if (bmp->reversed)
@@ -566,6 +564,8 @@ static bmp_result bmp_decode_rgb32(bmp_image *bmp, uint8_t 
**start, int bytes)
                                 scanline[x] = read_uint32((uint8_t 
*)&scanline[x],0);
                         }
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data++;
         }
         *start = data;
         return BMP_OK;
@@ -615,10 +615,6 @@ static bmp_result bmp_decode_rgb24(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3)) {
-                        data++;
-                }
-
                 if ((data + (3 * bmp->width)) > end) {
                         return BMP_INSUFFICIENT_DATA;
                 }
@@ -640,6 +636,9 @@ static bmp_result bmp_decode_rgb24(bmp_image *bmp, uint8_t 
**start, int bytes)
                         scanline[x] = read_uint32((uint8_t *)&scanline[x],0);
                 }
 
+                while (addr != (((intptr_t)data) & 3)) {
+                        data++;
+                }
         }
         *start = data;
         return BMP_OK;
@@ -683,8 +682,6 @@ static bmp_result bmp_decode_rgb16(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data += 2;
                 if ((data + (2 * bmp->width)) > end)
                         return BMP_INSUFFICIENT_DATA;
                 if (bmp->reversed)
@@ -726,6 +723,8 @@ static bmp_result bmp_decode_rgb16(bmp_image *bmp, uint8_t 
**start, int bytes)
                                 scanline[x] = read_uint32((uint8_t 
*)&scanline[x],0);
                         }
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data += 2;
         }
         *start = data;
         return BMP_OK;
@@ -775,8 +774,6 @@ static bmp_result bmp_decode_rgb(bmp_image *bmp, uint8_t 
**start, int bytes)
         }
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data++;
                 bit = 8;
                 if ((data + (bmp->width / ppb)) > end)
                         return BMP_INSUFFICIENT_DATA;
@@ -800,6 +797,8 @@ static bmp_result bmp_decode_rgb(bmp_image *bmp, uint8_t 
**start, int bytes)
                                 }
                         }
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data++;
         }
         *start = data;
         return BMP_OK;
@@ -828,11 +827,10 @@ static bmp_result bmp_decode_mask(bmp_image *bmp, uint8_t 
*data, int bytes)
                 return BMP_INSUFFICIENT_MEMORY;
         bottom = top + (uint64_t)swidth * (bmp->height - 1);
         end = data + bytes;
+
         addr = ((intptr_t)data) & 3;
 
         for (y = 0; y < bmp->height; y++) {
-                while (addr != (((intptr_t)data) & 3))
-                        data++;
                 if ((data + (bmp->width >> 3)) > end)
                         return BMP_INSUFFICIENT_DATA;
                 scanline = (void *)(bottom - (y * swidth));
@@ -848,6 +846,8 @@ static bmp_result bmp_decode_mask(bmp_image *bmp, uint8_t 
*data, int bytes)
                         scanline[x] = read_uint32((uint8_t *)&scanline[x], 0);
                         cur_byte = cur_byte << 1;
                 }
+                while (addr != (((intptr_t)data) & 3))
+                        data++;
         }
         return BMP_OK;
 }


-- 
NetSurf BMP Decoder

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to