mirror of
				https://git.code.sf.net/p/libpng/code.git
				synced 2025-07-10 18:04:09 +02:00 
			
		
		
		
	pngunknown fix for multiple IDAT chunks
Fixes the case where IDAT is treated as unknown and saved; the first IDAT chunk ends up 'before' IDAT, the rest 'after', pngunknown has to take this into account since it checks before and after.
This commit is contained in:
		
							parent
							
								
									b3a18efebf
								
							
						
					
					
						commit
						6bbc74d880
					
				@ -1001,6 +1001,20 @@ perform_one_test(FILE *fp, int argc, const char **argv,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   def = check(fp, argc, argv, flags[1], d, set_callback);
 | 
					   def = check(fp, argc, argv, flags[1], d, set_callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   /* If IDAT is being handled as unknown the image read is skipped and all the
 | 
				
			||||||
 | 
					    * IDATs after the first end up in the end info struct, so in this case add
 | 
				
			||||||
 | 
					    * IDAT to the list of unknowns.  (Do this after 'check' above sets the
 | 
				
			||||||
 | 
					    * chunk_info 'keep' fields.)
 | 
				
			||||||
 | 
					    *
 | 
				
			||||||
 | 
					    * Note that the flag setting has to be in the 'known' field to avoid
 | 
				
			||||||
 | 
					    * triggeriing the consistency check below and the flag must only be set if
 | 
				
			||||||
 | 
					    * there are multiple IDATs, so if the check above did find an unknown IDAT
 | 
				
			||||||
 | 
					    * after IDAT.
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					   if (chunk_info[0/*IDAT*/].keep != PNG_HANDLE_CHUNK_AS_DEFAULT &&
 | 
				
			||||||
 | 
					       (flags[1][3] & PNG_INFO_IDAT) != 0)
 | 
				
			||||||
 | 
					      flags[0][2] |= PNG_INFO_IDAT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /* Chunks should either be known or unknown, never both and this should apply
 | 
					   /* Chunks should either be known or unknown, never both and this should apply
 | 
				
			||||||
    * whether the chunk is before or after the IDAT (actually, the app can
 | 
					    * whether the chunk is before or after the IDAT (actually, the app can
 | 
				
			||||||
    * probably change this by swapping the handling after the image, but this
 | 
					    * probably change this by swapping the handling after the image, but this
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user