diff options
author | Karl Williamson <khw@cpan.org> | 2022-01-22 14:41:27 -0700 |
---|---|---|
committer | ℕicolas ℝ <nicolas@atoomic.org> | 2022-02-02 08:43:27 -0700 |
commit | e1c60a5de80391903ce3f33e708d032cd2ba9b0a (patch) | |
tree | 1045bc386393d7617a7b58fc76ba1c01380bfd85 /toke.c | |
parent | a460925186154b270b7a647a4f30b2f01fd97c4b (diff) | |
download | perl-e1c60a5de80391903ce3f33e708d032cd2ba9b0a.tar.gz |
toke.c: Fix potential C sign error
Taking (UV)(* char) isn't what was meant. Instead it should be
(UV) * (U8 *)(char).
(and the UV cast becomes irrelevant in this case).
If the C compiler defaults char to unsigned, it doesn't matter. Nor
does it matter if the char value is positive. But it gives the wrong
result when 'char' means 'signed char' and the value is negative.
Experimentally adding non-ASCII brackets to this code showed up this
error.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -11473,9 +11473,9 @@ Perl_scan_str(pTHX_ char *start, int keep_bracketed_quoted, int keep_delims, int *to++ = *s++; } /* allow nested opens and closes */ - else if ((UV)*s == PL_multi_close && --brackets <= 0) + else if (*(U8 *) s == PL_multi_close && --brackets <= 0) break; - else if ((UV)*s == PL_multi_open) + else if (*(U8 *) s == PL_multi_open) brackets++; else if (!d_is_utf8 && !UTF8_IS_INVARIANT((U8)*s) && UTF) d_is_utf8 = TRUE; |