MagickCore 7.1.2-32
Convert, Edit, Or Compose Bitmap Images
Loading...
Searching...
No Matches
constitute-private.h
1/*
2 Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License. You may
6 obtain a copy of the License at
7
8 https://imagemagick.org/license/
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 MagickCore private image constitute methods.
17*/
18#ifndef MAGICKCORE_CONSTITUTE_PRIVATE_H
19#define MAGICKCORE_CONSTITUTE_PRIVATE_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
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"
31
32static inline Image *StrictReadImage(ImageInfo *image_info,
33 ExceptionInfo *exception)
34{
35#define MagickMaxCoderDepth 250
36
37 char
38 magic[MagickPathExtent];
39
40 if (image_info->coder_depth++ >= MagickMaxCoderDepth)
41 {
42 errno=EPERM;
43 (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
44 "ImageNestedTooDeeply","`%s'",image_info->filename);
45 return((Image *) NULL);
46 }
47 (void) GetPathComponent(image_info->filename,MagickPath,magic);
48 if (*magic != '\0')
49 {
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));
54 else
55 {
56 (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
57 "ExplicitCoderNotAllowed","`%s'",image_info->filename);
58 return((Image *) NULL);
59 }
60 }
61 if (IsPathAccessible(image_info->filename) == MagickFalse)
62 {
63 (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
64 "UnableToOpenFile","`%s'",image_info->filename);
65 return((Image *) NULL);
66 }
67 return(ReadImage(image_info,exception));
68}
69
70#if defined(__cplusplus) || defined(c_plusplus)
71}
72#endif
73
74#endif