empty-input.patch 787 B

123456789101112131415161718192021222324252627
  1. From: Kamil Dudka <kdudka@redhat.com>
  2. Date: Mon, 14 Sep 2015 18:24:56 +0200
  3. Subject: fix infinite loop when extracting empty bzip2 data
  4. Bug-Debian: https://bugs.debian.org/802160
  5. Bug-RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=1260944
  6. Origin: other, https://bugzilla.redhat.com/attachment.cgi?id=1073339
  7. ---
  8. extract.c | 6 ++++++
  9. 1 file changed, 6 insertions(+)
  10. --- a/extract.c
  11. +++ b/extract.c
  12. @@ -2728,6 +2728,12 @@
  13. int repeated_buf_err;
  14. bz_stream bstrm;
  15. + if (G.incnt <= 0 && G.csize <= 0L) {
  16. + /* avoid an infinite loop */
  17. + Trace((stderr, "UZbunzip2() got empty input\n"));
  18. + return 2;
  19. + }
  20. +
  21. #if (defined(DLL) && !defined(NO_SLIDE_REDIR))
  22. if (G.redirect_slide)
  23. wsize = G.redirect_size, redirSlide = G.redirect_buffer;