mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 16:47:28 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b3331bbb3 | ||
|
|
e44920d382 | ||
|
|
3b882be500 | ||
|
|
6a8ee57ac0 |
No files matched your search
@@ -31152,6 +31152,30 @@ wuffs_gif__decoder__decode_id_part2(
|
|||||||
goto label__outer__continue;
|
goto label__outer__continue;
|
||||||
} else if (v_lzw_status.repr == wuffs_base__suspension__short_write) {
|
} else if (v_lzw_status.repr == wuffs_base__suspension__short_write) {
|
||||||
goto label__inner__continue;
|
goto label__inner__continue;
|
||||||
|
} else if (self->private_impl.f_quirks[3] && (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1) && (self->private_impl.f_interlace == 0)) {
|
||||||
|
if (v_need_block_size || (v_block_size > 0)) {
|
||||||
|
self->private_data.s_decode_id_part2[0].scratch = ((uint32_t)(v_block_size));
|
||||||
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||||
|
if (self->private_data.s_decode_id_part2[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
|
||||||
|
self->private_data.s_decode_id_part2[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
|
||||||
|
iop_a_src = io2_a_src;
|
||||||
|
status = wuffs_base__make_status(wuffs_base__suspension__short_read);
|
||||||
|
goto suspend;
|
||||||
|
}
|
||||||
|
iop_a_src += self->private_data.s_decode_id_part2[0].scratch;
|
||||||
|
if (a_src) {
|
||||||
|
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
|
||||||
|
}
|
||||||
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||||
|
status = wuffs_gif__decoder__skip_blocks(self, a_src);
|
||||||
|
if (a_src) {
|
||||||
|
iop_a_src = a_src->data.ptr + a_src->meta.ri;
|
||||||
|
}
|
||||||
|
if (status.repr) {
|
||||||
|
goto suspend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto label__outer__break;
|
||||||
}
|
}
|
||||||
status = v_lzw_status;
|
status = v_lzw_status;
|
||||||
if (wuffs_base__status__is_error(&status)) {
|
if (wuffs_base__status__is_error(&status)) {
|
||||||
|
|||||||
+29
-5
@@ -85,15 +85,15 @@ extern "C" {
|
|||||||
// each major.minor branch, the commit count should increase monotonically.
|
// each major.minor branch, the commit count should increase monotonically.
|
||||||
//
|
//
|
||||||
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
|
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
|
||||||
// 161e4730d8b446a72d6152b8343da8543e7518bf committed on 2021-11-18.
|
// e44920d382c9b542e17287664937e547becc7148 committed on 2021-11-19.
|
||||||
#define WUFFS_VERSION 0x000030000
|
#define WUFFS_VERSION 0x000030000
|
||||||
#define WUFFS_VERSION_MAJOR 0
|
#define WUFFS_VERSION_MAJOR 0
|
||||||
#define WUFFS_VERSION_MINOR 3
|
#define WUFFS_VERSION_MINOR 3
|
||||||
#define WUFFS_VERSION_PATCH 0
|
#define WUFFS_VERSION_PATCH 0
|
||||||
#define WUFFS_VERSION_PRE_RELEASE_LABEL "beta.11"
|
#define WUFFS_VERSION_PRE_RELEASE_LABEL "beta.12"
|
||||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3198
|
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3202
|
||||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20211118
|
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20211119
|
||||||
#define WUFFS_VERSION_STRING "0.3.0-beta.11+3198.20211118"
|
#define WUFFS_VERSION_STRING "0.3.0-beta.12+3202.20211119"
|
||||||
|
|
||||||
// ---------------- Configuration
|
// ---------------- Configuration
|
||||||
|
|
||||||
@@ -31153,6 +31153,30 @@ wuffs_gif__decoder__decode_id_part2(
|
|||||||
goto label__outer__continue;
|
goto label__outer__continue;
|
||||||
} else if (v_lzw_status.repr == wuffs_base__suspension__short_write) {
|
} else if (v_lzw_status.repr == wuffs_base__suspension__short_write) {
|
||||||
goto label__inner__continue;
|
goto label__inner__continue;
|
||||||
|
} else if (self->private_impl.f_quirks[3] && (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1) && (self->private_impl.f_interlace == 0)) {
|
||||||
|
if (v_need_block_size || (v_block_size > 0)) {
|
||||||
|
self->private_data.s_decode_id_part2[0].scratch = ((uint32_t)(v_block_size));
|
||||||
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||||
|
if (self->private_data.s_decode_id_part2[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
|
||||||
|
self->private_data.s_decode_id_part2[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
|
||||||
|
iop_a_src = io2_a_src;
|
||||||
|
status = wuffs_base__make_status(wuffs_base__suspension__short_read);
|
||||||
|
goto suspend;
|
||||||
|
}
|
||||||
|
iop_a_src += self->private_data.s_decode_id_part2[0].scratch;
|
||||||
|
if (a_src) {
|
||||||
|
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
|
||||||
|
}
|
||||||
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||||
|
status = wuffs_gif__decoder__skip_blocks(self, a_src);
|
||||||
|
if (a_src) {
|
||||||
|
iop_a_src = a_src->data.ptr + a_src->meta.ri;
|
||||||
|
}
|
||||||
|
if (status.repr) {
|
||||||
|
goto suspend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto label__outer__break;
|
||||||
}
|
}
|
||||||
status = v_lzw_status;
|
status = v_lzw_status;
|
||||||
if (wuffs_base__status__is_error(&status)) {
|
if (wuffs_base__status__is_error(&status)) {
|
||||||
|
|||||||
@@ -954,6 +954,17 @@ pri func decoder.decode_id_part2?(dst: ptr base.pixel_buffer, src: base.io_reade
|
|||||||
continue.outer
|
continue.outer
|
||||||
} else if lzw_status == base."$short write" {
|
} else if lzw_status == base."$short write" {
|
||||||
continue.inner
|
continue.inner
|
||||||
|
} else if this.quirks[QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA - QUIRKS_BASE] and
|
||||||
|
(this.dst_y >= this.frame_rect_y1) and (this.interlace == 0) {
|
||||||
|
// It's invalid LZW-compressed data, but we still have a full
|
||||||
|
// frame and have opted in to QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA,
|
||||||
|
// so treat it like the lzw_status.is_ok() case, other than not
|
||||||
|
// clearing this.previous_lzw_decode_ended_abruptly.
|
||||||
|
if need_block_size or (block_size > 0) {
|
||||||
|
args.src.skip_u32?(n: block_size as base.u32)
|
||||||
|
this.skip_blocks?(src: args.src)
|
||||||
|
}
|
||||||
|
break.outer
|
||||||
}
|
}
|
||||||
return lzw_status
|
return lzw_status
|
||||||
} endwhile.inner
|
} endwhile.inner
|
||||||
|
|||||||
+26
-8
@@ -1598,11 +1598,20 @@ test_wuffs_gif_decode_pixel_data_too_much_sans_quirk() {
|
|||||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||||
.data = g_src_slice_u8,
|
.data = g_src_slice_u8,
|
||||||
});
|
});
|
||||||
CHECK_STRING(
|
|
||||||
read_file(&src, "test/data/artificial-gif/pixel-data-too-much.gif"));
|
|
||||||
|
|
||||||
return do_test_wuffs_gif_decode_expecting(
|
src.meta = wuffs_base__empty_io_buffer_meta();
|
||||||
src, 0, wuffs_base__error__too_much_data, false);
|
CHECK_STRING(read_file(
|
||||||
|
&src, "test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif"));
|
||||||
|
CHECK_STRING(do_test_wuffs_gif_decode_expecting(
|
||||||
|
src, 0, wuffs_lzw__error__bad_code, false));
|
||||||
|
|
||||||
|
src.meta = wuffs_base__empty_io_buffer_meta();
|
||||||
|
CHECK_STRING(read_file(
|
||||||
|
&src, "test/data/artificial-gif/pixel-data-too-much-good-lzw.gif"));
|
||||||
|
CHECK_STRING(do_test_wuffs_gif_decode_expecting(
|
||||||
|
src, 0, wuffs_base__error__too_much_data, false));
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* //
|
const char* //
|
||||||
@@ -1611,11 +1620,20 @@ test_wuffs_gif_decode_pixel_data_too_much_with_quirk() {
|
|||||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||||
.data = g_src_slice_u8,
|
.data = g_src_slice_u8,
|
||||||
});
|
});
|
||||||
CHECK_STRING(
|
|
||||||
read_file(&src, "test/data/artificial-gif/pixel-data-too-much.gif"));
|
|
||||||
|
|
||||||
return do_test_wuffs_gif_decode_expecting(
|
src.meta = wuffs_base__empty_io_buffer_meta();
|
||||||
src, WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA, NULL, false);
|
CHECK_STRING(read_file(
|
||||||
|
&src, "test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif"));
|
||||||
|
CHECK_STRING(do_test_wuffs_gif_decode_expecting(
|
||||||
|
src, WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA, NULL, false));
|
||||||
|
|
||||||
|
src.meta = wuffs_base__empty_io_buffer_meta();
|
||||||
|
CHECK_STRING(read_file(
|
||||||
|
&src, "test/data/artificial-gif/pixel-data-too-much-good-lzw.gif"));
|
||||||
|
CHECK_STRING(do_test_wuffs_gif_decode_expecting(
|
||||||
|
src, WUFFS_GIF__QUIRK_IGNORE_TOO_MUCH_PIXEL_DATA, NULL, false));
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* //
|
const char* //
|
||||||
|
|||||||
+1
-1
@@ -794,7 +794,7 @@ test_wuffs_png_decode_metadata_kvp() {
|
|||||||
});
|
});
|
||||||
if (i < WUFFS_TESTLIB_ARRAY_SIZE(wants)) {
|
if (i < WUFFS_TESTLIB_ARRAY_SIZE(wants)) {
|
||||||
size_t n = strlen(wants[i]);
|
size_t n = strlen(wants[i]);
|
||||||
if (n < want.data.len) {
|
if (n <= want.data.len) {
|
||||||
memcpy(want.data.ptr, wants[i], n);
|
memcpy(want.data.ptr, wants[i], n);
|
||||||
want.meta.wi = n;
|
want.meta.wi = n;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 41 B |
@@ -0,0 +1,37 @@
|
|||||||
|
# Feed this file to script/make-artificial.go
|
||||||
|
|
||||||
|
make gif
|
||||||
|
|
||||||
|
header
|
||||||
|
|
||||||
|
image {
|
||||||
|
imageWidthHeight 2 2
|
||||||
|
palette {
|
||||||
|
0x00 0x00 0xFF
|
||||||
|
0x11 0x00 0xFF
|
||||||
|
0x22 0x00 0xFF
|
||||||
|
0x33 0x00 0xFF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
frame {
|
||||||
|
frameLeftTopWidthHeight 0 0 2 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# The frame area is 4 pixels and we supply 4 but then an invalid LZW code.
|
||||||
|
# Compare with pixel-data-too-much-good-lzw.gif.make-artificial.txt
|
||||||
|
#
|
||||||
|
# The disassembly (see also std/lzw/README.md) is:
|
||||||
|
#
|
||||||
|
# 0x02 LZW literal width.
|
||||||
|
# 0x02 GIF block length.
|
||||||
|
# 0x84 0xF1 = 0b1111_0001_1000_0100 (little endian).
|
||||||
|
# 0b...._...._...._.100 3-bit Clear code.
|
||||||
|
# 0b...._...._..00_0... 3-bit Literal 0x00.
|
||||||
|
# 0b...._...1_10.._.... 3-bit Copy code (2 bytes).
|
||||||
|
# 0b...._000._...._.... 3-bit Literal 0x00.
|
||||||
|
# 0b1111_...._...._.... 4-bit Invalid code.
|
||||||
|
# 0x00 GIF block terminator.
|
||||||
|
bytes 0x02 0x02 0x84 0xF1 0x00
|
||||||
|
|
||||||
|
trailer
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 41 B |
@@ -0,0 +1,37 @@
|
|||||||
|
# Feed this file to script/make-artificial.go
|
||||||
|
|
||||||
|
make gif
|
||||||
|
|
||||||
|
header
|
||||||
|
|
||||||
|
image {
|
||||||
|
imageWidthHeight 2 2
|
||||||
|
palette {
|
||||||
|
0x00 0x00 0xFF
|
||||||
|
0x11 0x00 0xFF
|
||||||
|
0x22 0x00 0xFF
|
||||||
|
0x33 0x00 0xFF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
frame {
|
||||||
|
frameLeftTopWidthHeight 0 0 2 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# The frame area is 4 pixels but we supply 5 (that's still valid LZW data).
|
||||||
|
# Compare with pixel-data-too-much-bad-lzw.gif.make-artificial.txt
|
||||||
|
#
|
||||||
|
# The equivalent bytes' disassembly (see also std/lzw/README.md) is:
|
||||||
|
#
|
||||||
|
# 0x02 LZW literal width.
|
||||||
|
# 0x02 GIF block length.
|
||||||
|
# 0x84 0x5D = 0b0101_1101_1000_0100 (little endian).
|
||||||
|
# 0b...._...._...._.100 3-bit Clear code.
|
||||||
|
# 0b...._...._..00_0... 3-bit Literal 0x00.
|
||||||
|
# 0b...._...1_10.._.... 3-bit Copy code (2 bytes).
|
||||||
|
# 0b...._110._...._.... 3-bit Copy code (2 bytes).
|
||||||
|
# 0b0101_...._...._.... 4-bit End code.
|
||||||
|
# 0x00 GIF block terminator.
|
||||||
|
lzw 2 0x00 0x00 0x00 0x00 0x00
|
||||||
|
|
||||||
|
trailer
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 41 B |
@@ -1,23 +0,0 @@
|
|||||||
# Feed this file to script/make-artificial.go
|
|
||||||
|
|
||||||
make gif
|
|
||||||
|
|
||||||
header
|
|
||||||
|
|
||||||
image {
|
|
||||||
imageWidthHeight 2 2
|
|
||||||
palette {
|
|
||||||
0x00 0x00 0xFF
|
|
||||||
0x11 0x00 0xFF
|
|
||||||
0x22 0x00 0xFF
|
|
||||||
0x33 0x00 0xFF
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
frame {
|
|
||||||
frameLeftTopWidthHeight 0 0 2 2
|
|
||||||
}
|
|
||||||
# The frame is 4 pixels, but we supply 5.
|
|
||||||
lzw 2 0x00 0x00 0x00 0x00 0x00
|
|
||||||
|
|
||||||
trailer
|
|
||||||
@@ -16,7 +16,8 @@ fdcc644f test/data/artificial-gif/metadata-full.gif
|
|||||||
76c44866 test/data/artificial-gif/no-frames.gif
|
76c44866 test/data/artificial-gif/no-frames.gif
|
||||||
6ec818c3 test/data/artificial-gif/pixel-data-none.gif
|
6ec818c3 test/data/artificial-gif/pixel-data-none.gif
|
||||||
5e57adb2 test/data/artificial-gif/pixel-data-not-enough.gif
|
5e57adb2 test/data/artificial-gif/pixel-data-not-enough.gif
|
||||||
3e29f88a test/data/artificial-gif/pixel-data-too-much.gif
|
3e29f88a test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif
|
||||||
|
3e29f88a test/data/artificial-gif/pixel-data-too-much-good-lzw.gif
|
||||||
f50d1d50 test/data/artificial-gif/small-frame-interlaced.gif
|
f50d1d50 test/data/artificial-gif/small-frame-interlaced.gif
|
||||||
beaec397 test/data/artificial-gif/transparent-index.gif
|
beaec397 test/data/artificial-gif/transparent-index.gif
|
||||||
6ec818c3 test/data/artificial-gif/zero-width-frame.gif
|
6ec818c3 test/data/artificial-gif/zero-width-frame.gif
|
||||||
|
|||||||
Reference in new issue
Block a user