patch-src_dcraw_cc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. $OpenBSD: patch-src_dcraw_cc,v 1.2 2017/05/02 15:48:41 espie Exp $
  2. fix CVE-2015-3885
  3. const correct.
  4. fix evaluation order.
  5. Index: src/dcraw.cc
  6. --- src/dcraw.cc.orig
  7. +++ src/dcraw.cc
  8. @@ -916,7 +916,8 @@ struct jhead {
  9. int CLASS ljpeg_start (struct jhead *jh, int info_only)
  10. {
  11. - int c, tag, len;
  12. + int c, tag;
  13. + ushort len;
  14. uchar data[0x10000], *dp;
  15. if (!info_only) init_decoder();
  16. @@ -2634,7 +2635,8 @@ void CLASS sony_decrypt (unsigned *data, int len, int
  17. pad[p] = htonl(pad[p]);
  18. }
  19. while (len--)
  20. - *data++ ^= pad[p++ & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127];
  21. + *data++ ^= pad[p & 127] = pad[(p+1) & 127] ^ pad[(p+65) & 127];
  22. + p++;
  23. }
  24. void CLASS sony_load_raw()
  25. @@ -8445,7 +8447,8 @@ int CLASS main (int argc, const char **argv)
  26. static int timestamp_only=0, thumbnail_only=0, identify_only=0;
  27. static int user_qual=-1, user_black=-1, user_sat=-1, user_flip=-1;
  28. static int use_fuji_rotate=1, write_to_stdout=0, quality, i, c;
  29. - static char opm, opt, *ofname, *cp, *bpfile=0;
  30. + static char opm, opt, *ofname, *cp2, *bpfile=0;
  31. + static const char *cp;
  32. static const char *sp, *dark_frame=0, *write_ext;
  33. static struct utimbuf ut;
  34. static FILE *ofp;
  35. @@ -8781,7 +8784,7 @@ thumbnail:
  36. strcpy (ofname,_("standard output"));
  37. else {
  38. strcpy (ofname, ifname);
  39. - if ((cp = strrchr (ofname, '.'))) *cp = 0;
  40. + if ((cp2 = strrchr (ofname, '.'))) *cp2 = 0;
  41. if (multi_out)
  42. sprintf (ofname+strlen(ofname), "_%0*d",
  43. snprintf(0,0,"%d",is_raw-1), shot_select);