[gdk-pixbuf] JPEG: skip bytes during incremental load
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] JPEG: skip bytes during incremental load
- Date: Thu, 2 Apr 2020 12:08:50 +0000 (UTC)
commit 35dcd72bbe7a9349861ff14389a38525fe9c949f
Author: Nathan Lee <utasstudent-git1271 yahoo com>
Date: Sat Feb 15 07:04:46 2020 +0000
JPEG: skip bytes during incremental load
Previously only skipped bytes at the start of incremental
loads. During a incremental load, there may be bytes to skip
between reloads. Previous behavior misread metadata sometimes.
Fixes #70
gdk-pixbuf/io-jpeg.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 7628989d9..ac6adbdf1 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -970,7 +970,7 @@ gdk_pixbuf__jpeg_image_load_lines (JpegProgContext *context,
* buf - new image data
* size - length of new image data
*
- * append image data onto inrecrementally built output image
+ * append image data onto incrementally built output image
*/
static gboolean
gdk_pixbuf__jpeg_image_load_increment (gpointer data,
@@ -1007,22 +1007,8 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
goto out;
}
- /* skip over data if requested, handle unsigned int sizes cleanly */
- /* only can happen if we've already called jpeg_get_header once */
- if (context->src_initialized && src->skip_next) {
- if (src->skip_next > size) {
- src->skip_next -= size;
- retval = TRUE;
- goto out;
- } else {
- num_left = size - src->skip_next;
- bufhd = buf + src->skip_next;
- src->skip_next = 0;
- }
- } else {
- num_left = size;
- bufhd = buf;
- }
+ num_left = size;
+ bufhd = buf;
if (num_left == 0) {
retval = TRUE;
@@ -1034,6 +1020,19 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
spinguard = 0;
first = TRUE;
while (TRUE) {
+ /* skip over data if requested, handle unsigned int sizes cleanly */
+ /* only can happen if we've already called jpeg_get_header */
+ if (context->src_initialized && src->skip_next) {
+ if (src->skip_next >= num_left) {
+ src->skip_next -= num_left;
+ retval = TRUE;
+ goto out;
+ } else {
+ num_left -= src->skip_next;
+ bufhd += src->skip_next;
+ src->skip_next = 0;
+ }
+ }
/* handle any data from caller we haven't processed yet */
if (num_left > 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]