CVE-2020-15389.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From e8e258ab049240c2dd1f1051b4e773b21e2d3dc0 Mon Sep 17 00:00:00 2001
  2. From: Even Rouault <even.rouault@spatialys.com>
  3. Date: Sun, 28 Jun 2020 14:19:59 +0200
  4. Subject: [PATCH] opj_decompress: fix double-free on input directory with mix
  5. of valid and invalid images (CVE-2020-15389)
  6. Fixes #1261
  7. Credits to @Ruia-ruia for reporting and analysis.
  8. ---
  9. src/bin/jp2/opj_decompress.c | 8 ++++----
  10. 1 file changed, 4 insertions(+), 4 deletions(-)
  11. --- end of original header ---
  12. CVE: CVE-2020-15389
  13. Upstream-Status: Backport [git://github.com/uclouvain/openjpeg.git]
  14. Signed-off-by: Joe Slater <joe.slater@windriver.com>
  15. ---
  16. diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c
  17. index 7eeb0952..2634907f 100644
  18. --- a/src/bin/jp2/opj_decompress.c
  19. +++ b/src/bin/jp2/opj_decompress.c
  20. @@ -1316,10 +1316,6 @@ static opj_image_t* upsample_image_components(opj_image_t* original)
  21. int main(int argc, char **argv)
  22. {
  23. opj_decompress_parameters parameters; /* decompression parameters */
  24. - opj_image_t* image = NULL;
  25. - opj_stream_t *l_stream = NULL; /* Stream */
  26. - opj_codec_t* l_codec = NULL; /* Handle to a decompressor */
  27. - opj_codestream_index_t* cstr_index = NULL;
  28. OPJ_INT32 num_images, imageno;
  29. img_fol_t img_fol;
  30. @@ -1393,6 +1389,10 @@ int main(int argc, char **argv)
  31. /*Decoding image one by one*/
  32. for (imageno = 0; imageno < num_images ; imageno++) {
  33. + opj_image_t* image = NULL;
  34. + opj_stream_t *l_stream = NULL; /* Stream */
  35. + opj_codec_t* l_codec = NULL; /* Handle to a decompressor */
  36. + opj_codestream_index_t* cstr_index = NULL;
  37. if (!parameters.quiet) {
  38. fprintf(stderr, "\n");
  39. --
  40. 2.17.1