From 6e79c4602f0bc54391be32e1c0799c55d212d99a Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Tue, 2 Jun 2026 13:37:15 +0200 Subject: [PATCH 1/2] [asimage] use volatile for pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix gcc warning: variable ‘upscaled_gray’ might be clobbered by ‘longjmp’ or ‘vfork’ --- builtins/libAfterImage/import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtins/libAfterImage/import.c b/builtins/libAfterImage/import.c index 2156a9398ae50..3920d7f34e32f 100644 --- a/builtins/libAfterImage/import.c +++ b/builtins/libAfterImage/import.c @@ -1212,7 +1212,7 @@ png2ASImage_int( void *data, png_rw_ptr read_fn, ASImageImportParams *params ) int bit_depth, color_type, interlace_type; int intent; ASScanline buf; - CARD8 *upscaled_gray = NULL; + CARD8 * volatile upscaled_gray = NULL; Bool do_alpha = False, grayscale = False ; png_bytep *row_pointers, row; unsigned int y; From f24e6c3c67f452bd2997287d0aea2fe3fc29ef85 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Tue, 2 Jun 2026 14:36:56 +0200 Subject: [PATCH 2/2] [asimage] fix compiler warning in xcf.c xcf.c:80:37: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=] gcc complains that pointer of struct member used in xcf_read32 to read three values. To be on the safe side - just read these values in temporary array and then copy to correspondent members --- builtins/libAfterImage/xcf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/builtins/libAfterImage/xcf.c b/builtins/libAfterImage/xcf.c index 0526ac8dff617..f47e494de0b53 100644 --- a/builtins/libAfterImage/xcf.c +++ b/builtins/libAfterImage/xcf.c @@ -118,10 +118,14 @@ read_xcf_image( FILE *fp ) xcf_im->version = 0 ; else xcf_im->version = atoi(&(sig[XCF_SIGNATURE_LEN+1])); - if( xcf_read32( fp, &(xcf_im->width), 3 ) < 3 ) - { + CARD32 arr[3]; + if( xcf_read32( fp, arr, 3 ) < 3 ) { free( xcf_im ); xcf_im = NULL ; + } else { + xcf_im->width = arr[0]; + xcf_im->height = arr[1]; + xcf_im->type = arr[2]; } } } @@ -609,11 +613,11 @@ read_xcf_hierarchy( XcfImage *xcf_im, FILE *fp, CARD8 opacity, ARGB32 colormask if (XCF_TILE_WIDTH < h->width) tile_buf = safemalloc (h->width*XCF_TILE_HEIGHT*6); - + if (xcf_im->width < h->width) for( i = 0 ; i < XCF_TILE_HEIGHT ; i++ ) { - free_scanline (&(xcf_im->scanline_buf[i]), True); + free_scanline (&(xcf_im->scanline_buf[i]), True); prepare_scanline (h->width,0,&(xcf_im->scanline_buf[i]), False ); } @@ -730,7 +734,7 @@ store_colors( CARD8 *data, ASScanline *curr_buf, int bpp, int comp, int offset_x }else out = &(curr_buf->alpha[offset_x]); - if( out ) + if( out ) for( i = 0 ; i < width ; i++ ) out[i] = data[i] ; }