External, Non-PPA KXStudio Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0KB

  1. Description: Upstream fix for CVE-2017-7186 (Upstream rev 1688)
  2. Fix Unicode property crash for 32-bit characters greater than 0x10ffff.
  3. Author: Matthew Vernon <matthew@debian.org>
  4. X-Dgit-Generated: 2:8.39-3 c4c2c7c4f74d53b263af2471d8e11db88096bd13
  5. ---
  6. --- pcre3-8.39.orig/pcre_internal.h
  7. +++ pcre3-8.39/pcre_internal.h
  8. @@ -2772,6 +2772,9 @@ extern const pcre_uint8 PRIV(ucd_stage1
  9. extern const pcre_uint16 PRIV(ucd_stage2)[];
  10. extern const pcre_uint32 PRIV(ucp_gentype)[];
  11. extern const pcre_uint32 PRIV(ucp_gbtable)[];
  12. +#ifdef COMPILE_PCRE32
  13. +extern const ucd_record PRIV(dummy_ucd_record)[];
  14. +#endif
  15. #ifdef SUPPORT_JIT
  16. extern const int PRIV(ucp_typerange)[];
  17. #endif
  18. @@ -2780,9 +2783,15 @@ extern const int PRIV(ucp_typera
  19. /* UCD access macros */
  20. #define UCD_BLOCK_SIZE 128
  21. -#define GET_UCD(ch) (PRIV(ucd_records) + \
  22. +#define REAL_GET_UCD(ch) (PRIV(ucd_records) + \
  23. PRIV(ucd_stage2)[PRIV(ucd_stage1)[(int)(ch) / UCD_BLOCK_SIZE] * \
  24. UCD_BLOCK_SIZE + (int)(ch) % UCD_BLOCK_SIZE])
  25. +
  26. +#ifdef COMPILE_PCRE32
  27. +#define GET_UCD(ch) ((ch > 0x10ffff)? PRIV(dummy_ucd_record) : REAL_GET_UCD(ch))
  28. +#else
  29. +#define GET_UCD(ch) REAL_GET_UCD(ch)
  30. +#endif
  31. #define UCD_CHARTYPE(ch) GET_UCD(ch)->chartype
  32. #define UCD_SCRIPT(ch) GET_UCD(ch)->script
  33. --- pcre3-8.39.orig/pcre_ucd.c
  34. +++ pcre3-8.39/pcre_ucd.c
  35. @@ -38,6 +38,20 @@ const pcre_uint16 PRIV(ucd_stage2)[] = {
  36. const pcre_uint32 PRIV(ucd_caseless_sets)[] = {0};
  37. #else
  38. +/* If the 32-bit library is run in non-32-bit mode, character values
  39. +greater than 0x10ffff may be encountered. For these we set up a
  40. +special record. */
  41. +
  42. +#ifdef COMPILE_PCRE32
  43. +const ucd_record PRIV(dummy_ucd_record)[] = {{
  44. + ucp_Common, /* script */
  45. + ucp_Cn, /* type unassigned */
  46. + ucp_gbOther, /* grapheme break property */
  47. + 0, /* case set */
  48. + 0, /* other case */
  49. + }};
  50. +#endif
  51. +
  52. /* When recompiling tables with a new Unicode version, please check the
  53. types in this structure definition from pcre_internal.h (the actual
  54. field names will be different):