# New Ticket Created by  Lars Balker Rasmussen 
# Please include the string:  [perl #24799]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=24799 >


chartype_create_from_mapping() (called from the op find_chartype) fails
to notice that it has run out of file, so happily parses the last line
twice.  This leads to writing to array[-1]...
-- 
Lars Balker Rasmussen                                      Consult::Perl

Index: src/chartype.c
===================================================================
RCS file: /cvs/public/parrot/src/chartype.c,v
retrieving revision 1.21
diff -u -a -r1.21 chartype.c
--- src/chartype.c	14 Nov 2003 20:27:02 -0000	1.21
+++ src/chartype.c	3 Jan 2004 16:10:34 -0000
@@ -183,7 +183,7 @@
 
     while (!feof(f)) {
         char *p = fgets(line, 80, f);
-        if (line[0] != '#') {
+        if (p && *p != '#') {
             int n = sscanf(line, "%li\t%li", &typecode, &unicode);
             if (n == 2 && typecode >= 0) {
                 if (typecode < 256 && typecode == one2one && 

Reply via email to