logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0009-Fix-CVE-2014-8139-CRC32-verification-heap-based-over.patch (2373B)


  1. From 9decdbe830f233fad7428df99e0c2d34887ac3cf Mon Sep 17 00:00:00 2001
  2. From: "Steven M. Schweda" <sms@antinode.info>
  3. Date: Sat, 15 Jun 2019 18:13:11 -0700
  4. Subject: [PATCH] Fix CVE-2014-8139: CRC32 verification heap-based overflow
  5. ---
  6. extract.c | 17 ++++++++++++++---
  7. 1 file changed, 14 insertions(+), 3 deletions(-)
  8. diff --git a/extract.c b/extract.c
  9. index 1acd769..df0fa1c 100644
  10. --- a/extract.c
  11. +++ b/extract.c
  12. @@ -1,5 +1,5 @@
  13. /*
  14. - Copyright (c) 1990-2009 Info-ZIP. All rights reserved.
  15. + Copyright (c) 1990-2014 Info-ZIP. All rights reserved.
  16. See the accompanying file LICENSE, version 2009-Jan-02 or later
  17. (the contents of which are also included in unzip.h) for terms of use.
  18. @@ -298,6 +298,8 @@ char ZCONST Far TruncNTSD[] =
  19. #ifndef SFX
  20. static ZCONST char Far InconsistEFlength[] = "bad extra-field entry:\n \
  21. EF block length (%u bytes) exceeds remaining EF data (%u bytes)\n";
  22. + static ZCONST char Far TooSmallEBlength[] = "bad extra-field entry:\n \
  23. + EF block length (%u bytes) invalid (< %d)\n";
  24. static ZCONST char Far InvalidComprDataEAs[] =
  25. " invalid compressed data for EAs\n";
  26. # if (defined(WIN32) && defined(NTSD_EAS))
  27. @@ -2023,7 +2025,8 @@ static int TestExtraField(__G__ ef, ef_len)
  28. ebID = makeword(ef);
  29. ebLen = (unsigned)makeword(ef+EB_LEN);
  30. - if (ebLen > (ef_len - EB_HEADSIZE)) {
  31. + if (ebLen > (ef_len - EB_HEADSIZE))
  32. + {
  33. /* Discovered some extra field inconsistency! */
  34. if (uO.qflag)
  35. Info(slide, 1, ((char *)slide, "%-22s ",
  36. @@ -2158,11 +2161,19 @@ static int TestExtraField(__G__ ef, ef_len)
  37. }
  38. break;
  39. case EF_PKVMS:
  40. - if (makelong(ef+EB_HEADSIZE) !=
  41. + if (ebLen < 4)
  42. + {
  43. + Info(slide, 1,
  44. + ((char *)slide, LoadFarString(TooSmallEBlength),
  45. + ebLen, 4));
  46. + }
  47. + else if (makelong(ef+EB_HEADSIZE) !=
  48. crc32(CRCVAL_INITIAL, ef+(EB_HEADSIZE+4),
  49. (extent)(ebLen-4)))
  50. + {
  51. Info(slide, 1, ((char *)slide,
  52. LoadFarString(BadCRC_EAs)));
  53. + }
  54. break;
  55. case EF_PKW32:
  56. case EF_PKUNIX:
  57. --
  58. 2.20.1