[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tigervnc-commits
Subject:    [Tigervnc-commits] SF.net SVN: tigervnc:[4012]
From:       dcommander () users ! sourceforge ! net
Date:       2010-03-21 1:01:49
Message-ID: E1Nt9Y5-0001av-8Q () sfp-svn-2 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 4012
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4012&view=rev
Author:   dcommander
Date:     2010-03-21 01:01:49 +0000 (Sun, 21 Mar 2010)

Log Message:
-----------
Fix data corruption issues when decompressing large JPEG images and/or using buffered \
I/O.  Specifically, decode_mcu_fast() can potentially process more than 1 MCU, so \
make sure there is enough space in the buffer to accommodate this case.  Otherwise, \
the buffer pointer goes negative, and bad mojo ensues.  Also, the fast decoder's \
method of handling unread markers doesn't make libjpeg's restart handler happy, so \
disable fast decode when restarts are used.

Modified Paths:
--------------
    trunk/common/jpeg/jdhuff.c

Modified: trunk/common/jpeg/jdhuff.c
===================================================================
--- trunk/common/jpeg/jdhuff.c	2010-03-19 16:13:05 UTC (rev 4011)
+++ trunk/common/jpeg/jdhuff.c	2010-03-21 01:01:49 UTC (rev 4012)
@@ -765,20 +765,25 @@
 decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
 {
   huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
+  int usefast = 1;
 
   /* Process restart marker if needed; may have to suspend */
   if (cinfo->restart_interval) {
     if (entropy->restarts_to_go == 0)
       if (! process_restart(cinfo))
 	return FALSE;
+    usefast = 0;
   }
 
+  if (cinfo->src->bytes_in_buffer < BUFSIZE * cinfo->blocks_in_MCU)
+    usefast = 0;
+
   /* If we've run out of data, just leave the MCU set to zeroes.
    * This way, we return uniform gray for the remainder of the segment.
    */
   if (! entropy->pub.insufficient_data) {
 
-    if (cinfo->src->bytes_in_buffer >= BUFSIZE) {
+    if (usefast) {
       if (!decode_mcu_fast(cinfo, MCU_data)) return FALSE;
     }
     else {


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Tigervnc-commits mailing list
Tigervnc-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic