Skip to content

segfault when a file should be written to a nonexistent directory #4124

@rumpelsepp

Description

@rumpelsepp

Describe the bug

The CLI tool zstd segfaults when a file should be written to a nonexistent directory.

To Reproduce

$ /bin/sh -c 'echo "foo" | zstd - -o /I/do/not/exist'
zstd: /I/do/not/exist: No such file or directory
Caught SIGSEGV signal, printing stack:
/lib/x86_64-linux-gnu/libc.so.6(setvbuf+0x11) [0x7f2051583fa1]
zstd(+0xeb977) [0x55a767eec977]
zstd(+0xf14fe) [0x55a767ef24fe]
zstd(+0xf579f) [0x55a767ef679f]
zstd(+0x61b0) [0x55a767e071b0]
/lib/x86_64-linux-gnu/libc.so.6(+0x2724a) [0x7f205153324a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f2051533305]
zstd(+0x7f81) [0x55a767e08f81]
Segmentation fault

Expected behavior

An error message is printed and a non-zero exit code is returned.

Desktop (please complete the following information):

  • OS: Debian
  • Version: stable
$ zstd --version
*** Zstandard CLI (64-bit) v1.5.4, by Yann Collet ***

Additional context

$ dpkg-query --showformat='${Version}\n' --show zstd
1.5.4+dfsg2-5

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions