ugrep: random crash and hang in option --zmax>1 when nested jar has a decompression error

Given the following folder structure, ugrep may segmentation fault or deadlock when using with -z and -r arg.

  --root folder (pwd)
    |-- a.jar
           |-- b.jar (within a.jar) 
    |-- b.jar

when decompress the jar file, following warning log indicated there are potential rc:

ugrep: warning: cannot decompress b.jar: a zlib decompression error was detected in the zip compressed data ugrep: warning: cannot decompress b.jar: EOF detected in the zip compressed data

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 16 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I found where it hung:

ugrep.cpp:1204
            if (is_selected && !drain && write(pipe_fd[1], buf, static_cast<size_t>(len)) < len)

the write call never return.