VirtualBox

Ignore:
Timestamp:
Feb 12, 2024 3:57:56 PM (12 months ago)
Author:
vboxsync
Message:

libpng-1.6.42: Applied and adjusted our libpng changes to 1.6.42. bugref:8515

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/libpng-1.6.42/pngerror.c

    r96425 r103316  
    22/* pngerror.c - stub functions for i/o and memory allocation
    33 *
    4  * Copyright (c) 2018 Cosmin Truta
     4 * Copyright (c) 2018-2024 Cosmin Truta
    55 * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
    66 * Copyright (c) 1996-1997 Andreas Dilger
     
    256256    png_alloc_size_t value)
    257257{
    258    char buffer[PNG_NUMBER_BUFFER_SIZE];
     258   char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
    259259   png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
    260260}
     
    266266   png_alloc_size_t u;
    267267   png_charp str;
    268    char buffer[PNG_NUMBER_BUFFER_SIZE];
     268   char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
    269269
    270270   /* Avoid overflow by doing the negate in a png_alloc_size_t: */
     
    859859      return NULL;
    860860
    861    return ((png_voidp)png_ptr->error_ptr);
     861   return (png_voidp)png_ptr->error_ptr;
    862862}
    863863
     
    934934
    935935int /* PRIVATE */
    936 png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
    937 {
    938    volatile png_imagep image = image_in;
    939    volatile int result;
    940    volatile png_voidp saved_error_buf;
     936png_safe_execute(png_imagep image, int (*function)(png_voidp), png_voidp arg)
     937{
     938   png_voidp saved_error_buf = image->opaque->error_buf;
    941939   jmp_buf safe_jmpbuf;
    942 
    943    /* Safely execute function(arg) with png_error returning to this function. */
    944    saved_error_buf = image->opaque->error_buf;
    945    result = setjmp(safe_jmpbuf) == 0;
    946 
    947    if (result != 0)
    948    {
    949 
     940   int result;
     941
     942   /* Safely execute function(arg), with png_error returning back here. */
     943   if (setjmp(safe_jmpbuf) == 0)
     944   {
    950945      image->opaque->error_buf = safe_jmpbuf;
    951946      result = function(arg);
    952    }
    953 
     947      image->opaque->error_buf = saved_error_buf;
     948      return result;
     949   }
     950
     951   /* On png_error, return via longjmp, pop the jmpbuf, and free the image. */
    954952   image->opaque->error_buf = saved_error_buf;
    955 
    956    /* And do the cleanup prior to any failure return. */
    957    if (result == 0)
    958       png_image_free(image);
    959 
    960    return result;
     953   png_image_free(image);
     954   return 0;
    961955}
    962956#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette