Skip to content

Commit

Permalink
Added extra check to prevent replacing a non-breaking space with a ne…
Browse files Browse the repository at this point in the history
…wline.
  • Loading branch information
dlemstra committed Oct 3, 2021
1 parent 1d59719 commit 6e82f6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion magick/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ MagickExport ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info,
q=draw_info->text;
continue;
}
if (IsUTFSpace(code) != MagickFalse)
if ((IsUTFSpace(code) != MagickFalse) &&
(IsNonBreakingUTFSpace(code) == MagickFalse))
{
s=p;
if (width > image->columns)
Expand Down
7 changes: 7 additions & 0 deletions magick/token-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ static inline unsigned int GetUTFOctets(const char *magick_restrict text)
return(octets);
}

static inline MagickBooleanType IsNonBreakingUTFSpace(int code)
{
if (code == 0x00a0)
return(MagickTrue);
return(MagickFalse);
}

static inline MagickBooleanType IsUTFSpace(int code)
{
if (((code >= 0x0009) && (code <= 0x000d)) || (code == 0x0020) ||
Expand Down

0 comments on commit 6e82f6f

Please sign in to comment.