Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15222

Re: Segmentation fault in pat_subst

From Eduardo A. Bustamante López <dualbus@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Segmentation fault in pat_subst
Date 2019-07-23 22:32 -0700
Message-ID <mailman.2126.1563946360.2688.bug-bash@gnu.org> (permalink)
References <20190720222300.GA13083@system76-pc.vc.shawcable.net> <f28d89b4-035f-134c-8184-fe5f019d7246@case.edu> <20190724053234.GA14361@system76-pc.vc.shawcable.net>

Show all headers | View raw


On Sun, Jul 21, 2019 at 06:56:09PM -0400, Chet Ramey wrote:
(...)
> Thanks for the report. Look at match_wpattern and consider what happens if
> wmatchlen returns something longer than the string length. It will be fixed
> for the next devel branch push.

Aha! I see.

| Starting program: /tmp/bash/bash -c x=0\;\ :\ \$\{x/\#\[0�\\Z\[:\]\]\}
| 
| Breakpoint 1, match_wpattern (wstring=0x5555556c1d90 L"0", indices=0x5555556c1e20, wstrlen=1, wpat=0x5555556c1d00 L"[0�\\Z[:]]", mtype=1, sp=0x7fffffffd918, ep=0x7fffffffd910)
|     at /home/dualbus/src/gnu/bash/subst.c:4963
| 4963      if (mlen > wstrlen)
| (gdb) p mlen
| $1 = 2
| (gdb) p wstrlen
| $2 = 1

Interesting, I can see how that `mlen = 2' can cause trouble. Thank you for the pointer and the fix!

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Segmentation fault in pat_subst Eduardo A. Bustamante López <dualbus@gmail.com> - 2019-07-23 22:32 -0700

csiph-web