Skip to content

Commit

Permalink
sv_utf8_decode(): use SSize_t for string offset
Browse files Browse the repository at this point in the history
While we can't test this easily from perl (as the comment mentions,
the pos() is cleared in utf8::decode()), testing under the debugger
revealed the pos value being truncated here, so use the correct
type.
  • Loading branch information
tonycoz committed Jul 12, 2023
1 parent f6af546 commit 6d66890
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3669,7 +3669,7 @@ Perl_sv_utf8_decode(pTHX_ SV *const sv)
/* adjust pos to the start of a UTF8 char sequence */
MAGIC * mg = mg_find(sv, PERL_MAGIC_regex_global);
if (mg) {
I32 pos = mg->mg_len;
SSize_t pos = mg->mg_len;
if (pos > 0) {
for (c = start + pos; c > start; c--) {
if (UTF8_IS_START(*c))
Expand Down

0 comments on commit 6d66890

Please sign in to comment.