From: Cristy Date: Sat, 3 Mar 2018 14:30:37 +0000 (-0500) Subject: https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=33455 X-Git-Tag: 7.0.7-25~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=25a3d08ed68789268b1c849250772ccf3031362f;p=imagemagick https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=33455 --- diff --git a/MagickCore/image.c b/MagickCore/image.c index 97d8e1794..895d49eeb 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -1638,12 +1638,12 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, register const char *p; - size_t - field_width, - length; + ssize_t + field_width, + offset; canonical=MagickFalse; - length=0; + offset=0; (void) CopyMagickString(filename,format,MagickPathExtent); for (p=strchr(format,'%'); p != (char *) NULL; p=strchr(p+1,'%')) { @@ -1665,9 +1665,9 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, q++; c=(*q); *q='\0'; - (void) FormatLocaleString(filename+(p-format),(size_t) - (MagickPathExtent-(p-format)),p,value); - length+=(4-field_width); + (void) FormatLocaleString(filename+(p-format-offset),(size_t) + (MagickPathExtent-(p-format-offset)),p,value); + offset+=(4-field_width); *q=c; (void) ConcatenateMagickString(filename,q,MagickPathExtent); canonical=MagickTrue; @@ -1696,9 +1696,6 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, /* Image option. */ - /* FUTURE: Compare update with code from InterpretImageProperties() - Note that a 'filename:' property should not need depth recursion. - */ if (strchr(p,']') == (char *) NULL) break; depth=1; @@ -1729,9 +1726,9 @@ MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, q--; c=(*q); *q='\0'; - (void) CopyMagickString(filename+(p-format-length),option,(size_t) - (MagickPathExtent-(p-format-length))); - length+=strlen(pattern)-1; + (void) CopyMagickString(filename+(p-format-offset),option,(size_t) + (MagickPathExtent-(p-format-offset))); + offset+=strlen(pattern)-4; *q=c; (void) ConcatenateMagickString(filename,r+1,MagickPathExtent); canonical=MagickTrue;