"Fossies" - the Fresh Open Source Software Archive

Member "libgd-2.3.2/tests/heif/heif_ptr_double_free.c" (3 Mar 2021, 607 Bytes) of package /linux/www/libgd-2.3.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /**
    2  * Test that failure to convert to HEIF returns NULL
    3  *
    4  * We are creating an image, set its width to zero, and pass this image to
    5  * `gdImageHeifPtr()` which is supposed to fail, and as such should return NULL.
    6  *
    7  * See also <https://github.com/libgd/libgd/issues/381>
    8  */
    9 
   10 
   11 #include "gd.h"
   12 #include "gdtest.h"
   13 
   14 
   15 int main()
   16 {
   17     gdImagePtr src, dst;
   18     int size;
   19 
   20     src = gdImageCreateTrueColor(1, 10);
   21     gdTestAssert(src != NULL);
   22 
   23     src->sx = 0;
   24 
   25     dst = gdImageHeifPtrEx(src, &size, 0, GD_HEIF_CODEC_HEVC, GD_HEIF_CHROMA_444);
   26     gdTestAssert(dst == NULL);
   27 
   28     gdImageDestroy(src);
   29 
   30     return gdNumFailures();
   31 }