Project

General

Profile

Actions

Bug #4860

closed

ksh93: core in printf

Added by Garrett D'Amore over 7 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2014-05-13
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

I have found several ways to core printf in ksh93. For example:

printf '%1$*2$s' 5 x

printf '%3$*.*s' 6 2 abc
Segmentation Fault (core dumped)

I had found quite a slew of others, but they may be mostly errors around the n$ syntax handling since that is what I was testing the most. Unfortunately, I didn't capture all of them that I've seen over the past several days.


Related issues

Related to illumos gate - Feature #13405: ksh93 update to 2012-08-01ClosedAndy Fiddaman

Actions
Actions #1

Updated by Andy Fiddaman 11 months ago

Actions #2

Updated by Andy Fiddaman 11 months ago

  • Status changed from New to In Progress
  • Assignee set to Andy Fiddaman

Testing with the updated ksh93 93u+ 2012-08-1 from #13405, this appears to be fixed.

af@build:...s/usr/src/cmd/ast/ksh/builtins$ echo $KSH_VERSION
Version JM 93t+ 2010-03-05
af@build:...s/usr/src/cmd/ast/ksh/builtins$ printf '%3$*.*s' 6 2 abc
zsh: segmentation fault (core dumped)  ksh

versus

af@bloody:~$ echo $KSH_VERSION
Version jMP 93u+ 2012-08-01
af@bloody:~$ printf '%3$*.*s' 6 2 abc
    ab  
Actions #3

Updated by Electric Monk 11 months ago

  • Gerrit CR set to 1175
Actions #4

Updated by Electric Monk 10 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f

commit  b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2021-01-30T17:13:33.000Z

    13405 ksh93 update to 2012-08-01
    13434 sh: mishandles backslash as last character of a block of input
    11750 ksh mkdir builtin doesn't honor special file permissions
    9199 ksh93 builtin *grep -v mishandles blank lines, blows up libgcrypt-config
    6756 sh (and ksh) have issues with ${1+"$@"}
    6520 ksh: sleep could wait forever
    4860 ksh93: core in printf
    3791 /bin/sh's builtin 'rm' busted: 'rm -f' without arguments returns error
    1047 ksh overwrites child core files
    880 ksh93 coredumps on 'unset'
    499 "interrupted system call" when using "tee" builtin in ksh
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Reviewed by: Dominik Hassler <hadfl@omnios.org>
    Approved by: Rich Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF