(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
deref-before-check-macro-pr108745.c
       1  /* Reduced from ImageMagick-7.1.0-57.  */
       2  
       3  #define NULL ((void *)0)
       4  
       5  typedef __builtin_va_list va_list;
       6  typedef __SIZE_TYPE__ size_t;
       7  
       8  typedef struct _ExceptionInfo ExceptionInfo;
       9  
      10  void
      11  ThrowMagickException(ExceptionInfo*,
      12  		     const char*,
      13  		     const char*,
      14  		     ...) __attribute__((__format__(__printf__, 3, 4)));
      15  
      16  typedef struct _Image
      17  {
      18    /* [...snip...] */
      19    size_t columns, rows, depth, colors;
      20    /* [...snip...] */
      21  } Image;
      22  
      23  typedef struct _ImageInfo
      24  {
      25    /* [...snip...] */
      26    char filename[4096];
      27    /* [...snip...] */
      28  } ImageInfo;
      29  
      30  extern Image *AcquireImage(const ImageInfo*, ExceptionInfo*);
      31  extern void CloseBlob(Image*);
      32  extern Image *DestroyImageList(Image*);
      33  
      34  #define ThrowReaderException(tag) \
      35  { \
      36    (void) ThrowMagickException(exception, tag, \
      37      "`%s'",image_info->filename); \
      38    if ((image) != (Image *) NULL) \
      39      { \
      40        (void) CloseBlob(image); \
      41        image=DestroyImageList(image); \
      42      } \
      43    return((Image *) NULL); \
      44  }
      45  
      46  Image*
      47  ReadMAPImage(const ImageInfo* image_info, ExceptionInfo* exception)
      48  {
      49    Image* image;
      50    image = AcquireImage(image_info, exception);
      51    if ((image->columns == 0) || (image->rows == 0))
      52      ThrowReaderException("MustSpecifyImageSize");
      53    return image;
      54  }