Gitweb links:
...log
http://git.netsurf-browser.org/libnsgif.git/shortlog/af6ab260260383f86b2dde2c2973ad59f7c42d05
...commit
http://git.netsurf-browser.org/libnsgif.git/commit/af6ab260260383f86b2dde2c2973ad59f7c42d05
...tree
http://git.netsurf-browser.org/libnsgif.git/tree/af6ab260260383f86b2dde2c2973ad59f7c42d05
The branch, master has been updated
via af6ab260260383f86b2dde2c2973ad59f7c42d05 (commit)
from 099b873abca6b868f159e16894f3640d40dca5aa (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/libnsgif.git/commit/?id=af6ab260260383f86b2dde2c2973ad59f7c42d05
commit af6ab260260383f86b2dde2c2973ad59f7c42d05
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
LZW decoder: Squash scan-build error by adding assert.
Note, for scan-build to correctly interpret the assert, the library
must be built in debug mode:
$ scan-build-4.0 make VARIANT=debug
diff --git a/src/lzw.c b/src/lzw.c
index 6b7156e..6ad95aa 100644
--- a/src/lzw.c
+++ b/src/lzw.c
@@ -6,6 +6,7 @@
* Copyright 2017 Michael Drake <[email protected]>
*/
+#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -160,6 +161,8 @@ static inline lzw_result lzw__next_code(
uint8_t current_bit = ctx->sb_bit & 0x7;
uint8_t byte_advance = (current_bit + code_size) >> 3;
+ assert(byte_advance <= 2);
+
if (ctx->sb_bit + code_size < ctx->sb_bit_count) {
/* Fast path: code fully inside this sub-block */
const uint8_t *data = ctx->sb_data + (ctx->sb_bit >> 3);
-----------------------------------------------------------------------
Summary of changes:
src/lzw.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lzw.c b/src/lzw.c
index 6b7156e..6ad95aa 100644
--- a/src/lzw.c
+++ b/src/lzw.c
@@ -6,6 +6,7 @@
* Copyright 2017 Michael Drake <[email protected]>
*/
+#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -160,6 +161,8 @@ static inline lzw_result lzw__next_code(
uint8_t current_bit = ctx->sb_bit & 0x7;
uint8_t byte_advance = (current_bit + code_size) >> 3;
+ assert(byte_advance <= 2);
+
if (ctx->sb_bit + code_size < ctx->sb_bit_count) {
/* Fast path: code fully inside this sub-block */
const uint8_t *data = ctx->sb_data + (ctx->sb_bit >> 3);
--
NetSurf GIF Decoder
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org