comparison png.c @ 2346:0111c8344477

Fix some issues identified by asan/ubsan
author Michael Pavone <pavone@retrodev.com>
date Sat, 07 Oct 2023 18:04:35 -0700
parents eb45ad9d8a3f
children
comparison
equal deleted inserted replaced
2345:c76c81c21ae5 2346:0111c8344477
335 uint8_t alpha = **cur = filter(*cur, *last, bpp, x); 335 uint8_t alpha = **cur = filter(*cur, *last, bpp, x);
336 (*cur)++; 336 (*cur)++;
337 if (*last) { 337 if (*last) {
338 (*last)++; 338 (*last)++;
339 } 339 }
340 return alpha << 24 | red << 16 | green << 8 | blue; 340 return ((uint32_t)alpha) << 24 | red << 16 | green << 8 | blue;
341 } 341 }
342 342
343 static filter_fun filters[] = {filter_none, filter_sub, filter_up, filter_avg, filter_paeth}; 343 static filter_fun filters[] = {filter_none, filter_sub, filter_up, filter_avg, filter_paeth};
344 344
345 #define MIN_CHUNK_SIZE 12 345 #define MIN_CHUNK_SIZE 12