Coverage Report

Created: 2026-09-28 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/imagemagick/MagickCore/constitute-private.h
Line
Count
Source
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)
22
extern "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
32
static inline Image *StrictReadImage(ImageInfo *image_info,
33
  ExceptionInfo *exception)
34
24.7k
{
35
24.7k
#define MagickMaxCoderDepth  250
36
37
24.7k
  char
38
24.7k
    magic[MagickPathExtent];
39
40
24.7k
  if (image_info->coder_depth++ >= MagickMaxCoderDepth)
41
0
    {
42
0
      errno=EPERM;
43
0
      (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
44
0
        "ImageNestedTooDeeply","`%s'",image_info->filename);
45
0
      return((Image *) NULL);
46
0
    }
47
24.7k
  (void) GetPathComponent(image_info->filename,MagickPath,magic);
48
24.7k
  if (*magic != '\0')
49
23.2k
    {
50
23.2k
      const MagickInfo *magick_info = GetMagickInfo(magic,exception);
51
23.2k
      if ((magick_info != (const MagickInfo *) NULL) &&
52
21.7k
          (GetMagickExplicitAllowed(magick_info) != MagickFalse))
53
1.21k
          return(ReadImage(image_info,exception));
54
22.0k
      else
55
22.0k
        {
56
22.0k
          (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
57
22.0k
            "ExplicitCoderNotAllowed","`%s'",image_info->filename);
58
22.0k
          return((Image *) NULL);
59
22.0k
        }
60
23.2k
    }
61
1.54k
  if (IsPathAccessible(image_info->filename) == MagickFalse)
62
1.31k
    {
63
1.31k
      (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
64
1.31k
        "UnableToOpenFile","`%s'",image_info->filename);
65
1.31k
      return((Image *) NULL);
66
1.31k
    }
67
227
  return(ReadImage(image_info,exception));
68
1.54k
}
Unexecuted instantiation: constitute.c:StrictReadImage
draw.c:StrictReadImage
Line
Count
Source
34
24.7k
{
35
24.7k
#define MagickMaxCoderDepth  250
36
37
24.7k
  char
38
24.7k
    magic[MagickPathExtent];
39
40
24.7k
  if (image_info->coder_depth++ >= MagickMaxCoderDepth)
41
0
    {
42
0
      errno=EPERM;
43
0
      (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
44
0
        "ImageNestedTooDeeply","`%s'",image_info->filename);
45
0
      return((Image *) NULL);
46
0
    }
47
24.7k
  (void) GetPathComponent(image_info->filename,MagickPath,magic);
48
24.7k
  if (*magic != '\0')
49
23.2k
    {
50
23.2k
      const MagickInfo *magick_info = GetMagickInfo(magic,exception);
51
23.2k
      if ((magick_info != (const MagickInfo *) NULL) &&
52
21.7k
          (GetMagickExplicitAllowed(magick_info) != MagickFalse))
53
1.21k
          return(ReadImage(image_info,exception));
54
22.0k
      else
55
22.0k
        {
56
22.0k
          (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
57
22.0k
            "ExplicitCoderNotAllowed","`%s'",image_info->filename);
58
22.0k
          return((Image *) NULL);
59
22.0k
        }
60
23.2k
    }
61
1.54k
  if (IsPathAccessible(image_info->filename) == MagickFalse)
62
1.31k
    {
63
1.31k
      (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
64
1.31k
        "UnableToOpenFile","`%s'",image_info->filename);
65
1.31k
      return((Image *) NULL);
66
1.31k
    }
67
227
  return(ReadImage(image_info,exception));
68
1.54k
}
Unexecuted instantiation: identify.c:StrictReadImage
Unexecuted instantiation: magick.c:StrictReadImage
Unexecuted instantiation: json.c:StrictReadImage
Unexecuted instantiation: svg.c:StrictReadImage
Unexecuted instantiation: yaml.c:StrictReadImage
69
70
#if defined(__cplusplus) || defined(c_plusplus)
71
}
72
#endif
73
74
#endif