develooper Front page | perl.perl5.porters | Postings from January 2017

[perl #130567] toke.c:3885: S_scan_const: Assertion `isUTF8_CHAR((U8*) s, (U8 *) send)' failed.

Thread Previous | Thread Next
From:
Sergey Aleynikov via RT
Date:
January 27, 2017 22:25
Subject:
[perl #130567] toke.c:3885: S_scan_const: Assertion `isUTF8_CHAR((U8*) s, (U8 *) send)' failed.
Message ID:
rt-4.0.24-7830-1485555953-1534.130567-15-0@perl.org
On Wed, 25 Jan 2017 21:42:09 -0800, khw wrote:
> Thanks for the report.  Fixed by 90b58c702e376ab45f13a7f10e14d8c786d05d8a

This can still be hit by the following 19-bytes program:

% hexdump -C ../0045
00000000  42 45 47 49 4e 7b 24 5e  48 3d 2d 31 7d 73 00 ff  |BEGIN{$^H=-1}s..|
00000010  ff 00 00                                          |...|
00000013

On debugging builds it gives:

Malformed UTF-8 character: \xff\xff (overflows) at ../0045 line 1.
Malformed UTF-8 character: \xff\xff (too short; 2 bytes available, need 13) at ../0045 line 1.
Malformed UTF-8 character: \xff\xff (unexpected non-continuation byte 0xff, immediately after start byte 0xff; need 13 bytes, got 1) at ../0045 line 1.
perl: toke.c:3975: S_scan_const: Assertion `(__builtin_expect(((((U8 *) send) <= ((U8 *) s)) ? (_Bool)1 : (_Bool)0),(0)) ? 0 : (((unsigned long)(((*(U8 *) s) | 0) | 0) < 128)) ? 1 : __builtin_expect((((((U8 *) send) - ((U8 *) s)) < PL_utf8skip[*(const U8*)((U8 *) s)]) ? (_Bool)1 : (_Bool)0),(0)) ? 0 : __builtin_expect((((((( (sizeof(*(U8 *) s) == 1) || !(((unsigned long)((*(U8 *) s) | 0)) & ~0xFF))) ? (void) (0) : __assert_fail ("( (sizeof(*(U8 *) s) == 1) || !(((unsigned long)((*(U8 *) s) | 0)) & ~0xFF))", "toke.c", 3975, __PRETTY_FUNCTION__)), ((U8) (*(U8 *) s))) <= 0xF7) ? (_Bool)1 : (_Bool)0),(1)) ? ( ( 0xC2 <= ((const U8*)(U8 *) s)[0] && ((const U8*)(U8 *) s)[0] <= 0xDF ) ? ( __builtin_expect(((( ((const U8*)(U8 *) s)[1] & 0xC0 ) == 0x80) ? (_Bool)1 : (_Bool)0),(1)) ? 2 : 0 ) : ( 0xE0 == ((const U8*)(U8 *) s)[0] ) ? ( __builtin_expect(((( ( ((const U8*)(U8 *) s)[1] & 0xE0 ) == 0xA0 ) && ( ( ((const U8*)(U8 *) s)[2] & 0xC0 ) == 0x80 )) ? (_Bool)1 : (_Bool)0),(1)) ? 3 : 0 
 ): ( 0xE1 <= ((const U8*)(U8 *) s)[0] && ((const U8*)(U8 *) s)[0] <= 0xEF ) ? ( __builtin_expect(((( ( ((const U8*)(U8 *) s)[1] & 0xC0 ) == 0x80 ) && ( ( ((const U8*)(U8 *) s)[2] & 0xC0 ) == 0x80 )) ? (_Bool)1 : (_Bool)0),(1)) ? 3 : 0 ): ( 0xF0 == ((const U8*)(U8 *) s)[0] ) ? ( __builtin_expect(((( ( 0x90 <= ((const U8*)(U8 *) s)[1] && ((const U8*)(U8 *) s)[1] <= 0xBF ) && ( ( ((const U8*)(U8 *) s)[2] & 0xC0 ) == 0x80 ) ) && ( ( ((const U8*)(U8 *) s)[3] & 0xC0 ) == 0x80 )) ? (_Bool)1 : (_Bool)0),(1)) ? 4 : 0 ): ( ( ( ( 0xF1 <= ((const U8*)(U8 *) s)[0] && ((const U8*)(U8 *) s)[0] <= 0xF7 ) && __builtin_expect(((( ((const U8*)(U8 *) s)[1] & 0xC0 ) == 0x80) ? (_Bool)1 : (_Bool)0),(1)) ) && __builtin_expect(((( ((const U8*)(U8 *) s)[2] & 0xC0 ) == 0x80) ? (_Bool)1 : (_Bool)0),(1)) ) && __builtin_expect(((( ((const U8*)(U8 *) s)[3] & 0xC0 ) == 0x80) ? (_Bool)1 : (_Bool)0),(1)) ) ? 4 : 0 ) : Perl__is_utf8_char_helper((U8 *) s, (U8 *) send, 0))' failed.
zsh: abort      ./perl ../0045

On non-debugging builds it produces panic():

Malformed UTF-8 character: \xff\xff (overflows) at ../0045 line 1.
Malformed UTF-8 character: \xff\xff (too short; 2 bytes available, need 13) at ../0045 line 1.
Malformed UTF-8 character: \xff\xff (unexpected non-continuation byte 0xff, immediately after start byte 0xff; need 13 bytes, got 1) at ../0045 line 1.
panic: constant overflowed allocated space, 14 >= 10 at ../0045 line 1.

---
via perlbug:  queue: perl5 status: resolved
https://rt.perl.org/Ticket/Display.html?id=130567

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About