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


Groups > gnu.bash.bug > #15222 > unrolled thread

Re: Segmentation fault in pat_subst

Started byEduardo A. Bustamante López <dualbus@gmail.com>
First post2019-07-23 22:32 -0700
Last post2019-07-23 22:32 -0700
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#15222 — Re: Segmentation fault in pat_subst

FromEduardo A. Bustamante López <dualbus@gmail.com>
Date2019-07-23 22:32 -0700
SubjectRe: Segmentation fault in pat_subst
Message-ID<mailman.2126.1563946360.2688.bug-bash@gnu.org>
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!

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web