Hi,

I noticed a bug in mg with regex search.

A way to reproduce the issue:

* Create a file with atleast one empty line, for example:

"a

b"

* Move the cursor after "a".
* M-x re-search-forward, use a term like "^$".

Result: Segmentation fault (core dumped)

Reproduced on -current on amd64.

Backtrace:

(gdb) bt
#0  sslow (m=0x7f7fffff6008, start=0x1 <Address 0x1 out of bounds>, stop=0x0, 
startst=1,
    stopst=2) at regex/engine.c:779
#1  0x0000013fa9b9a9d0 in regexec (preg=Variable "preg" is not available.
) at regex/engine.c:201
#2  0x0000013d432f55de in re_forwsrch () at /usr/src/usr.bin/mg/re_search.c:335
#3  0x0000013d432f5273 in re_forwsearch (f=0, n=1) at 
/usr/src/usr.bin/mg/re_search.c:62
#4  0x0000013d432e8615 in extend (f=0, n=1) at /usr/src/usr.bin/mg/extend.c:549
#5  0x0000013d432efb8c in mgwrap (funct=0x13d432e84d0 <extend>, f=0, n=1)
    at /usr/src/usr.bin/mg/kbd.c:461
#6  0x0000013d432efac1 in doin () at /usr/src/usr.bin/mg/kbd.c:167
#7  0x0000013d432f3020 in main (argc=0, argv=0x7f7fffff6350) at 
/usr/src/usr.bin/mg/main.c:211

-- 
Kind regards,
Hiltjo

Reply via email to