From 570d6ae5251c18b50b024936e261cf0a158ddf97 Mon Sep 17 00:00:00 2001 From: Hayaki Saito Date: Fri, 3 Aug 2018 04:33:45 +0900 Subject: [PATCH 1/4] Quickfix for issue #72: validate huffman code https://github.com/saitoha/libsixel/issues/72 --- src/stb_image.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/stb_image.h b/src/stb_image.h index 26738094..8d4dab62 100644 --- a/src/stb_image.h +++ b/src/stb_image.h @@ -2017,6 +2017,7 @@ static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__ // first scan for DC coefficient, must be first memset(data,0,64*sizeof(data[0])); // 0 all the ac values now t = stbi__jpeg_huff_decode(j, hdc); + if (t < 0 || t >= 16) return stbi__err("bad huffman code","Corrupt JPEG"); diff = t ? stbi__extend_receive(j, t) : 0; dc = j->img_comp[b].dc_pred + diff; From 9873ac3595b81ed74ed9724ad13df241c57e7bc5 Mon Sep 17 00:00:00 2001 From: Hayaki Saito Date: Fri, 13 Dec 2019 01:40:58 +0900 Subject: [PATCH 2/4] Drop mingw32 build --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29d306e4..0cb80ad3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,8 @@ matrix: env: XCC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" PREFIX="/usr/i686-w64-mingw32" DEBUG="--enable-tests --enable-debug" WINE=wine - os: linux env: XCC=i586-mingw32msvc-gcc HOST="--host=i586-mingw32msvc" PREFIX="/usr/i586-mingw32msvc" WINE=wine - - os: linux - env: XCC=x86_64-w64-mingw32-gcc HOST="--host=x86_64-w64-mingw32" PREFIX="/usr/x86_64-w64-mingw32" DEBUG="--enable-tests --enable-debug" WINE=wine64 +# - os: linux +# env: XCC=x86_64-w64-mingw32-gcc HOST="--host=x86_64-w64-mingw32" PREFIX="/usr/x86_64-w64-mingw32" DEBUG="--enable-tests --enable-debug" WINE=wine64 - os: linux env: XCC=clang HOST= PREFIX=/usr DEBUG="--enable-tests --enable-debug" WINE= JPEG="--with-jpeg" PNG="--with-png" - os: osx @@ -68,7 +68,7 @@ before_install: - "if [ x$TRAVIS_OS_NAME = xlinux -a x$XCC = xclang ]; then sudo apt-get install -qq clang; fi" - "if [ x$TRAVIS_OS_NAME = xlinux -a x$XCC = xgcc ]; then sudo apt-get install -qq gcc; fi" - "if [ x$TRAVIS_OS_NAME = xlinux -a x$XCC = xi686-w64-mingw32-gcc ]; then sudo apt-get install -qq gcc-mingw-w64-i686 binutils-mingw-w64-i686; fi" - - "if [ x$TRAVIS_OS_NAME = xlinux -a x$XCC = xi586-mingw32msvc-gcc ]; then sudo apt-get install -qq mingw32; fi" +# - "if [ x$TRAVIS_OS_NAME = xlinux -a x$XCC = xi586-mingw32msvc-gcc ]; then sudo apt-get install -qq mingw32; fi" - "if [ x$TRAVIS_OS_NAME = xlinux -a x$XCC = xx86_64-w64-mingw32-gcc ]; then sudo apt-get install -qq gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64; fi" - "if [ x$TRAVIS_OS_NAME = xlinux -a x$GCOV != x ]; then sudo apt-get install libyaml-dev; fi" - "if [ x$TRAVIS_OS_NAME = xosx -a x$GCOV != x ]; then brew install libyaml; fi" From 5e6aa372733c6425f9ab1f5f04bf84f2eca1526e Mon Sep 17 00:00:00 2001 From: Hayaki Saito Date: Fri, 13 Dec 2019 02:47:25 +0900 Subject: [PATCH 3/4] Ammend fix for e18ebe6 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0cb80ad3..4b2ecc61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,10 +11,10 @@ matrix: env: XCC=clang HOST= PREFIX=/usr/local DEBUG="--enable-tests --enable-debug" WINE= LIBCURL=--without-libcurl JPEG=--without-jpeg PNG=--without-png - os: linux env: XCC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" PREFIX="/usr/i686-w64-mingw32" DEBUG="--enable-tests --enable-debug" WINE=wine +#t - os: linux +# env: XCC=i586-mingw32msvc-gcc HOST="--host=i586-mingw32msvc" PREFIX="/usr/i586-mingw32msvc" WINE=wine - os: linux - env: XCC=i586-mingw32msvc-gcc HOST="--host=i586-mingw32msvc" PREFIX="/usr/i586-mingw32msvc" WINE=wine -# - os: linux -# env: XCC=x86_64-w64-mingw32-gcc HOST="--host=x86_64-w64-mingw32" PREFIX="/usr/x86_64-w64-mingw32" DEBUG="--enable-tests --enable-debug" WINE=wine64 + env: XCC=x86_64-w64-mingw32-gcc HOST="--host=x86_64-w64-mingw32" PREFIX="/usr/x86_64-w64-mingw32" DEBUG="--enable-tests --enable-debug" WINE=wine64 - os: linux env: XCC=clang HOST= PREFIX=/usr DEBUG="--enable-tests --enable-debug" WINE= JPEG="--with-jpeg" PNG="--with-png" - os: osx From 49a6013d9c89addb4d616d6f697c06d96eb21dab Mon Sep 17 00:00:00 2001 From: Hayaki Saito Date: Fri, 13 Dec 2019 02:34:29 +0900 Subject: [PATCH 4/4] Suppress glib deprecated warnings --- src/loader.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/loader.c b/src/loader.c index cb1e61f8..64da4315 100644 --- a/src/loader.c +++ b/src/loader.c @@ -941,10 +941,11 @@ load_with_gdkpixbuf( GdkPixbuf *pixbuf; GdkPixbufAnimation *animation; GdkPixbufLoader *loader = NULL; -#if 1 GdkPixbufAnimationIter *it; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" GTimeVal time_val; -#endif +#pragma GCC diagnostic pop sixel_frame_t *frame = NULL; int stride; unsigned char *p; @@ -963,7 +964,10 @@ load_with_gdkpixbuf( #if (!GLIB_CHECK_VERSION(2, 36, 0)) g_type_init(); #endif +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" g_get_current_time(&time_val); +#pragma GCC diagnostic pop loader = gdk_pixbuf_loader_new(); gdk_pixbuf_loader_write(loader, pchunk->buffer, pchunk->size, NULL); animation = gdk_pixbuf_loader_get_animation(loader); @@ -1006,7 +1010,10 @@ load_with_gdkpixbuf( goto end; } } else { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" g_get_current_time(&time_val); +#pragma GCC diagnostic pop frame->frame_no = 0; @@ -1014,7 +1021,10 @@ load_with_gdkpixbuf( for (;;) { while (!gdk_pixbuf_animation_iter_on_currently_loading_frame(it)) { frame->delay = gdk_pixbuf_animation_iter_get_delay_time(it); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" g_time_val_add(&time_val, frame->delay * 1000); +#pragma GCC diagnostic pop frame->delay /= 10; pixbuf = gdk_pixbuf_animation_iter_get_pixbuf(it); if (pixbuf == NULL) {