This bug is similar to bug#16586.

It seems that the pointer `eptr' for a current position in a text
exceeded the starting position in backword searching.  I seem that PCRE
library may assume that a text doesn't have invalid sequence in UTF-8.

Could you re-try in them non-UTF8 locales?

Norihiro
$ gdb src/grep core.1430
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/staff/b/grep-2.18/src/grep...done.
[New LWP 1430]

warning: Can't read pathname for load map: Input/output error.
Core was generated by `src/grep -P .?ma test-image.png'.
Program terminated with signal 11, Segmentation fault.
#0  0x001612ca in match (eptr=0x9a24fff <Address 0x9a24fff out of bounds>, 
ecode=0x9a25e65 "\035m\035ax",
    mstart=0x9a26e9d 
"\272\374;\017\233\323\230:\364\005+\373a&\367\032X\304\216 
\342y\274\301\357\361\005",
    offset_top=2, md=0xbfe18a64, eptrb=0x0, rdepth=0) at pcre_exec.c:5943
5943              BACKCHAR(eptr);
(gdb) bt
#0  0x001612ca in match (eptr=0x9a24fff <Address 0x9a24fff out of bounds>, 
ecode=0x9a25e65 "\035m\035ax",
    mstart=0x9a26e9d 
"\272\374;\017\233\323\230:\364\005+\373a&\367\032X\304\216 
\342y\274\301\357\361\005",
    offset_top=2, md=0xbfe18a64, eptrb=0x0, rdepth=0) at pcre_exec.c:5943
#1  0x0016308a in pcre_exec (argument_re=0x9a25e28, extra_data=0x9a25e78,
    subject=0x9a26e9d 
"\272\374;\017\233\323\230:\364\005+\373a&\367\032X\304\216 
\342y\274\301\357\361\005",
    length=101, start_offset=0, options=8192, offsets=0xbfe18bdc, 
offsetcount=300) at pcre_exec.c:6941
#2  0x0805a472 in Pexecute (buf=0x9a26000 "\211PNG\r\n\032\n", size=6568, 
match_size=0xbfe19114, start_ptr=0x0)
    at pcresearch.c:174
#3  0x0804ba07 in do_execute (buf=0x9a26000 "\211PNG\r\n\032\n", size=6568, 
match_size=0xbfe19114, start_ptr=0x0)
    at grep.c:1073
#4  0x0804bc98 in grepbuf (beg=0x9a26000 "\211PNG\r\n\032\n",
    lim=0x9a279a8 
"\217\222(\016\001c\025R\221c\233S\250\327\177m\002\344Q\022\362$\320\066\376\327\245{\f\035D\001\260\251\326a\247{T\200_\bj8\274")
 at grep.c:1109
#5  0x0804bfb3 in grep (fd=3, st=0xbfe19200) at grep.c:1220
#6  0x0804c9ab in grepdesc (desc=3, command_line=1) at grep.c:1474
#7  0x0804c650 in grepfile (dirdesc=-100, name=0xbfe19889 "test-image.png", 
follow=1, command_line=1) at grep.c:1375
#8  0x0804cc22 in grep_command_line_arg (arg=0xbfe19889 "test-image.png") at 
grep.c:1526
#9  0x0804e358 in main (argc=4, argv=0xbfe194a4) at grep.c:2362

Reply via email to