mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	[master] Moved declarations of umsg[] inside proper #ifdef blocks in pngrutil.c
This commit is contained in:
		
							parent
							
								
									2c55e3e917
								
							
						
					
					
						commit
						ac4942e26b
					
				
							
								
								
									
										5
									
								
								ANNOUNCE
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								ANNOUNCE
									
									
									
									
									
								
							@ -1,5 +1,5 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Libpng 1.4.2rc06 - April 29, 2010
 | 
					Libpng 1.4.2rc06 - May 3, 2010
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This is not intended to be a public release.  It will be replaced
 | 
					This is not intended to be a public release.  It will be replaced
 | 
				
			||||||
within a few weeks by a public version or by another test version.
 | 
					within a few weeks by a public version or by another test version.
 | 
				
			||||||
@ -60,6 +60,9 @@ version 1.4.2rc05 [April 29, 2010]
 | 
				
			|||||||
    png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
 | 
					    png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
 | 
				
			||||||
    but was left defined in pngtrans.c
 | 
					    but was left defined in pngtrans.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					version 1.4.2rc06 [May 3, 2010]
 | 
				
			||||||
 | 
					  Moved declarations of umsg[] inside the proper #ifdef blocks in pngrutil.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Send comments/corrections/commendations to glennrp at users.sourceforge.net
 | 
					Send comments/corrections/commendations to glennrp at users.sourceforge.net
 | 
				
			||||||
or to png-mng-implement at lists.sf.net (subscription required; visit
 | 
					or to png-mng-implement at lists.sf.net (subscription required; visit
 | 
				
			||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
 | 
					https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										3
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								CHANGES
									
									
									
									
									
								
							@ -2571,6 +2571,9 @@ version 1.4.2rc05 [April 29, 2010]
 | 
				
			|||||||
    png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
 | 
					    png.h is removed if both READ and WRITE USER_TRANSFORM are turned off
 | 
				
			||||||
    but was left defined in pngtrans.c
 | 
					    but was left defined in pngtrans.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					version 1.4.2rc06 [May 3, 2010]
 | 
				
			||||||
 | 
					  Moved declarations of umsg[] inside the proper #ifdef blocks in pngrutil.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Send comments/corrections/commendations to glennrp at users.sourceforge.net
 | 
					Send comments/corrections/commendations to glennrp at users.sourceforge.net
 | 
				
			||||||
or to png-mng-implement at lists.sf.net (subscription required; visit
 | 
					or to png-mng-implement at lists.sf.net (subscription required; visit
 | 
				
			||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
 | 
					https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										111
									
								
								pngrutil.c
									
									
									
									
									
								
							
							
						
						
									
										111
									
								
								pngrutil.c
									
									
									
									
									
								
							@ -203,7 +203,7 @@ png_crc_error(png_structp png_ptr)
 | 
				
			|||||||
    defined(PNG_READ_iCCP_SUPPORTED)
 | 
					    defined(PNG_READ_iCCP_SUPPORTED)
 | 
				
			||||||
static png_size_t
 | 
					static png_size_t
 | 
				
			||||||
png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
 | 
					png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
 | 
				
			||||||
	png_bytep output, png_size_t output_size)
 | 
					        png_bytep output, png_size_t output_size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   png_size_t count = 0;
 | 
					   png_size_t count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -229,11 +229,11 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
 | 
				
			|||||||
      if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0)
 | 
					      if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         if (output != 0 && output_size > count)
 | 
					         if (output != 0 && output_size > count)
 | 
				
			||||||
	 {
 | 
					         {
 | 
				
			||||||
	    int copy = output_size - count;
 | 
					            int copy = output_size - count;
 | 
				
			||||||
	    if (avail < copy) copy = avail;
 | 
					            if (avail < copy) copy = avail;
 | 
				
			||||||
	    png_memcpy(output + count, png_ptr->zbuf, copy);
 | 
					            png_memcpy(output + count, png_ptr->zbuf, copy);
 | 
				
			||||||
	 }
 | 
					         }
 | 
				
			||||||
         count += avail;
 | 
					         count += avail;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -254,31 +254,33 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
 | 
				
			|||||||
       * buffer if available.
 | 
					       * buffer if available.
 | 
				
			||||||
       */
 | 
					       */
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         char *msg, umsg[52];
 | 
					         char *msg;
 | 
				
			||||||
	 if (png_ptr->zstream.msg != 0)
 | 
					         if (png_ptr->zstream.msg != 0)
 | 
				
			||||||
	    msg = png_ptr->zstream.msg;
 | 
					            msg = png_ptr->zstream.msg;
 | 
				
			||||||
	 else
 | 
					         else
 | 
				
			||||||
	 {
 | 
					         {
 | 
				
			||||||
#ifdef PNG_STDIO_SUPPORTED
 | 
					#ifdef PNG_STDIO_SUPPORTED
 | 
				
			||||||
	    switch (ret)
 | 
					            char umsg[52];
 | 
				
			||||||
	    {
 | 
					 | 
				
			||||||
	 case Z_BUF_ERROR:
 | 
					 | 
				
			||||||
	    msg = "Buffer error in compressed datastream in %s chunk";
 | 
					 | 
				
			||||||
	    break;
 | 
					 | 
				
			||||||
	 case Z_DATA_ERROR:
 | 
					 | 
				
			||||||
	    msg = "Data error in compressed datastream in %s chunk";
 | 
					 | 
				
			||||||
	    break;
 | 
					 | 
				
			||||||
	 default:
 | 
					 | 
				
			||||||
	    msg = "Incomplete compressed datastream in %s chunk";
 | 
					 | 
				
			||||||
	    break;
 | 
					 | 
				
			||||||
	    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
 | 
					            switch (ret)
 | 
				
			||||||
	    msg = umsg;
 | 
					            {
 | 
				
			||||||
 | 
					               case Z_BUF_ERROR:
 | 
				
			||||||
 | 
					                  msg = "Buffer error in compressed datastream in %s chunk";
 | 
				
			||||||
 | 
					                  break;
 | 
				
			||||||
 | 
					               case Z_DATA_ERROR:
 | 
				
			||||||
 | 
					                  msg = "Data error in compressed datastream in %s chunk";
 | 
				
			||||||
 | 
					                  break;
 | 
				
			||||||
 | 
					               default:
 | 
				
			||||||
 | 
					                  msg = "Incomplete compressed datastream in %s chunk";
 | 
				
			||||||
 | 
					                  break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
 | 
				
			||||||
 | 
					            msg = umsg;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	    msg = "Damaged compressed datastream in chunk other than IDAT";
 | 
					            msg = "Damaged compressed datastream in chunk other than IDAT";
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	 }
 | 
					         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         png_warning(png_ptr, msg);
 | 
					         png_warning(png_ptr, msg);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -313,9 +315,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
 | 
				
			|||||||
   else if (comp_type == PNG_COMPRESSION_TYPE_BASE)
 | 
					   else if (comp_type == PNG_COMPRESSION_TYPE_BASE)
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
      png_size_t expanded_size = png_inflate(png_ptr,
 | 
					      png_size_t expanded_size = png_inflate(png_ptr,
 | 
				
			||||||
		(png_bytep)(png_ptr->chunkdata + prefix_size),
 | 
					                (png_bytep)(png_ptr->chunkdata + prefix_size),
 | 
				
			||||||
                chunklength - prefix_size,
 | 
					                chunklength - prefix_size,
 | 
				
			||||||
		0/*output*/, 0/*output size*/);
 | 
					                0/*output*/, 0/*output size*/);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* Now check the limits on this chunk - if the limit fails the
 | 
					      /* Now check the limits on this chunk - if the limit fails the
 | 
				
			||||||
       * compressed data will be removed, the prefix will remain.
 | 
					       * compressed data will be removed, the prefix will remain.
 | 
				
			||||||
@ -341,41 +343,42 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
 | 
				
			|||||||
      if (expanded_size > 0)
 | 
					      if (expanded_size > 0)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
         /* Success (maybe) - really uncompress the chunk. */
 | 
					         /* Success (maybe) - really uncompress the chunk. */
 | 
				
			||||||
	 png_size_t new_size = 0;
 | 
					         png_size_t new_size = 0;
 | 
				
			||||||
	 png_charp text = png_malloc_warn(png_ptr,
 | 
					         png_charp text = png_malloc_warn(png_ptr,
 | 
				
			||||||
			prefix_size + expanded_size + 1);
 | 
					                        prefix_size + expanded_size + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         if (text != NULL)
 | 
					         if (text != NULL)
 | 
				
			||||||
         {
 | 
					         {
 | 
				
			||||||
	    png_memcpy(text, png_ptr->chunkdata, prefix_size);
 | 
					            png_memcpy(text, png_ptr->chunkdata, prefix_size);
 | 
				
			||||||
	    new_size = png_inflate(png_ptr,
 | 
					            new_size = png_inflate(png_ptr,
 | 
				
			||||||
                (png_bytep)(png_ptr->chunkdata + prefix_size),
 | 
					                (png_bytep)(png_ptr->chunkdata + prefix_size),
 | 
				
			||||||
		chunklength - prefix_size,
 | 
					                chunklength - prefix_size,
 | 
				
			||||||
                (png_bytep)(text + prefix_size), expanded_size);
 | 
					                (png_bytep)(text + prefix_size), expanded_size);
 | 
				
			||||||
	    text[prefix_size + expanded_size] = 0; /* just in case */
 | 
					            text[prefix_size + expanded_size] = 0; /* just in case */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    if (new_size == expanded_size)
 | 
					            if (new_size == expanded_size)
 | 
				
			||||||
	    {
 | 
					            {
 | 
				
			||||||
	       png_free(png_ptr, png_ptr->chunkdata);
 | 
					               png_free(png_ptr, png_ptr->chunkdata);
 | 
				
			||||||
	       png_ptr->chunkdata = text;
 | 
					               png_ptr->chunkdata = text;
 | 
				
			||||||
	       *newlength = prefix_size + expanded_size;
 | 
					               *newlength = prefix_size + expanded_size;
 | 
				
			||||||
	       return; /* The success return! */
 | 
					               return; /* The success return! */
 | 
				
			||||||
	    }
 | 
					            }
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
	    png_warning(png_ptr, "png_inflate logic error");
 | 
					            png_warning(png_ptr, "png_inflate logic error");
 | 
				
			||||||
	    png_free(png_ptr, text);
 | 
					            png_free(png_ptr, text);
 | 
				
			||||||
	 }
 | 
					         }
 | 
				
			||||||
	 else
 | 
					         else
 | 
				
			||||||
          png_warning(png_ptr, "Not enough memory to decompress chunk");
 | 
					          png_warning(png_ptr, "Not enough memory to decompress chunk");
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
 | 
					   else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
 | 
				
			||||||
   {
 | 
					   {
 | 
				
			||||||
 | 
					#ifdef PNG_STDIO_SUPPORTED
 | 
				
			||||||
      char umsg[50];
 | 
					      char umsg[50];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef PNG_STDIO_SUPPORTED
 | 
					      png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d",
 | 
				
			||||||
      png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d", comp_type);
 | 
					          comp_type);
 | 
				
			||||||
      png_warning(png_ptr, umsg);
 | 
					      png_warning(png_ptr, umsg);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
      png_warning(png_ptr, "Unknown zTXt compression type");
 | 
					      png_warning(png_ptr, "Unknown zTXt compression type");
 | 
				
			||||||
@ -392,13 +395,13 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
 | 
				
			|||||||
      png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
 | 
					      png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
 | 
				
			||||||
      if (text != NULL)
 | 
					      if (text != NULL)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
	 if (prefix_size > 0)
 | 
					         if (prefix_size > 0)
 | 
				
			||||||
            png_memcpy(text, png_ptr->chunkdata, prefix_size);
 | 
					            png_memcpy(text, png_ptr->chunkdata, prefix_size);
 | 
				
			||||||
	 png_free(png_ptr, png_ptr->chunkdata);
 | 
					         png_free(png_ptr, png_ptr->chunkdata);
 | 
				
			||||||
	 png_ptr->chunkdata = text;
 | 
					         png_ptr->chunkdata = text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	 /* This is an extra zero in the 'uncompressed' part. */
 | 
					         /* This is an extra zero in the 'uncompressed' part. */
 | 
				
			||||||
	 *(png_ptr->chunkdata + prefix_size) = 0x00;
 | 
					         *(png_ptr->chunkdata + prefix_size) = 0x00;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      /* Ignore a malloc error here - it is safe. */
 | 
					      /* Ignore a malloc error here - it is safe. */
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user