Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion botched running utf8 warnings #1207

Closed
p5pRT opened this issue Feb 22, 2000 · 2 comments
Closed

assertion botched running utf8 warnings #1207

p5pRT opened this issue Feb 22, 2000 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 22, 2000

Migrated from rt.perl.org#2188 (status was 'resolved')

Searchable as RT2188$

@p5pRT
Copy link
Author

p5pRT commented Feb 22, 2000

From @jhi

Robin Barker writes​:

This is a bug report for perl from rmb1@​tempest.cise.npl.co.uk,
generated with the help of perlbug 1.27 running under perl v5.5.660.

-----------------------------------------------------------------
[Please enter your report here]

perl5.5.660 failed one test. A simple example is​:

% ./perl -Ilib -Mutf8 -we 'my $a = "snøstorm";'
Malformed UTF-8 character at -e line 1.
assertion botched (chunk's tail overwrite?)​:
*((char *)((caddr_t)ovp + nbytes - sizeof (unsigned int) + i)) == 0x55

I'm afraid this one's beyond me to suggest a patch.

Robin

Strictly speaking the "ø" *is* a malformed utf-8 character...but
whether Perl is right in complaining about it, I dion't know, because
I'm not up to snuff with the current utf8 developments. And, of
course, the mysterious assertion failure message from Perl malloc is
not necessarily something we want to end user to see.

--
$jhi++; # http​://www.iki.fi/jhi/
  # There is this special biologist word we use for 'stable'.
  # It is 'dead'. -- Jack Cohen

@p5pRT
Copy link
Author

p5pRT commented Feb 22, 2000

From @gsar

On Tue, 22 Feb 2000 18​:23​:55 GMT, Robin Barker wrote​:

perl5.5.660 failed one test. A simple example is​:

% ./perl -Ilib -Mutf8 -we 'my $a = "snøstorm";'
Malformed UTF-8 character at -e line 1.
assertion botched (chunk's tail overwrite?)​:
*((char *)((caddr_t)ovp + nbytes - sizeof (unsigned int) + i)) == 0x55

I'm afraid this one's beyond me to suggest a patch.

I just fix this a few minutes ago.

Sarathy
gsar@​ActiveState.com

Inline Patch
-----------------------------------8<-----------------------------------
--- perl/toke.c.~1~	Tue Feb 22 09:54:06 2000
+++ perl/toke.c	Tue Feb 22 09:54:06 2000
@@ -1298,9 +1298,9 @@
 	   (void)utf8_to_uv((U8*)s, &len);
 	   if (len == 1) {
 	       /* illegal UTF8, make it valid */
-	       /* need to grow with 1 char to be safe */
 	       char *old_pvx = SvPVX(sv);
-	       d = SvGROW(sv, SvCUR(sv)+2) + (d - old_pvx);
+	       /* need space for one extra char (NOTE: SvCUR() not set here) */
+	       d = SvGROW(sv, SvLEN(sv) + 1) + (d - old_pvx);
 	       d = (char*)uv_to_utf8((U8*)d, (U8)*s++);
 	   }
 	   else {
End of Patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant