The fix for this is, unfortunately, to rewrite the whole variable
expansion code, which will however have benefits:

• we can get array trimming working in the same go

• we can fix the issue reported by izabera and confirmed by Geoff and
Chet:

        tglase@tglase:~ $ ksh93 -c 'a="~/x"; echo "<${a#~}> <${a#\~}>"'
        <~/x> </x>
        tglase@tglase:~ $ mksh -c 'a="~/x"; echo "<${a#~}> <${a#\~}>"'
        </x> </x>

  (this is, tilde expansion is mandated for a couple of expansions' RHS,
like ${x#y} in POSIX and ${x/y} extension which is modelled after it)

-- 
You received this bug notification because you are a member of mksh
Mailing List, which is subscribed to mksh.
Matching subscriptions: mkshlist-to-mksh-bugmail
https://bugs.launchpad.net/bugs/1453827

Title:
  complex substitutions inside complex substitutions (both using ADELIM)
  read past allocated memory

Status in The MirBSD Korn Shell:
  Triaged

Bug description:
  Reproducer:

  valgrind --track-origins=yes --leak-check=no b/mksh -c
  'foo=${bar//baz/${sum:1}}'

  This seems to be a nesting problem. A closing ADELIM omits the CSUBST,
  which also irritates wdscan (which seems flakey anyway), which is what
  the substitution uses.

  Workaround: use temporary variables.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1453827/+subscriptions

Reply via email to