18#ifndef MAGICKCORE_CONSTITUTE_PRIVATE_H
19#define MAGICKCORE_CONSTITUTE_PRIVATE_H
21#if defined(__cplusplus) || defined(c_plusplus)
25#include "MagickCore/constitute.h"
26#include "MagickCore/exception.h"
27#include "MagickCore/log.h"
28#include "MagickCore/magick.h"
29#include "MagickCore/magick-private.h"
30#include "MagickCore/utility.h"
32static inline Image *StrictReadImage(ImageInfo *image_info,
33 ExceptionInfo *exception)
35#define MagickMaxCoderDepth 250
38 magic[MagickPathExtent];
40 if (image_info->coder_depth++ >= MagickMaxCoderDepth)
43 (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
44 "ImageNestedTooDeeply",
"`%s'",image_info->filename);
45 return((Image *) NULL);
47 (void) GetPathComponent(image_info->filename,MagickPath,magic);
50 const MagickInfo *magick_info = GetMagickInfo(magic,exception);
51 if ((magick_info != (
const MagickInfo *) NULL) &&
52 (GetMagickExplicitAllowed(magick_info) != MagickFalse))
53 return(ReadImage(image_info,exception));
56 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
57 "ExplicitCoderNotAllowed",
"`%s'",image_info->filename);
58 return((Image *) NULL);
61 if (IsPathAccessible(image_info->filename) == MagickFalse)
63 (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
64 "UnableToOpenFile",
"`%s'",image_info->filename);
65 return((Image *) NULL);
67 return(ReadImage(image_info,exception));
70#if defined(__cplusplus) || defined(c_plusplus)