libid3tag-0.15.1b-handle-unknown-encoding.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #! /bin/sh /usr/share/dpatch/dpatch-run
  2. ## 11_unknown_encoding.dpatch by Andreas Henriksson <andreas@fatal.se>
  3. ##
  4. ## All lines beginning with `## DP:' are a description of the patch.
  5. ## DP: In case of an unknown/invalid encoding, id3_parse_string() will
  6. ## DP: return NULL, but the return value wasn't checked resulting
  7. ## DP: in segfault in id3_ucs4_length(). This is the only place
  8. ## DP: the return value wasn't checked.
  9. @DPATCH@
  10. diff -urNad libid3tag-0.15.1b~/compat.gperf libid3tag-0.15.1b/compat.gperf
  11. --- libid3tag-0.15.1b~/compat.gperf 2004-01-23 09:41:32.000000000 +0000
  12. +++ libid3tag-0.15.1b/compat.gperf 2007-01-14 14:36:53.000000000 +0000
  13. @@ -236,6 +236,10 @@
  14. encoding = id3_parse_uint(&data, 1);
  15. string = id3_parse_string(&data, end - data, encoding, 0);
  16. + if (!string)
  17. + {
  18. + continue;
  19. + }
  20. if (id3_ucs4_length(string) < 4) {
  21. free(string);
  22. diff -urNad libid3tag-0.15.1b~/parse.c libid3tag-0.15.1b/parse.c
  23. --- libid3tag-0.15.1b~/parse.c 2004-01-23 09:41:32.000000000 +0000
  24. +++ libid3tag-0.15.1b/parse.c 2007-01-14 14:37:34.000000000 +0000
  25. @@ -165,6 +165,9 @@
  26. case ID3_FIELD_TEXTENCODING_UTF_8:
  27. ucs4 = id3_utf8_deserialize(ptr, length);
  28. break;
  29. + default:
  30. + /* FIXME: Unknown encoding! Print warning? */
  31. + return NULL;
  32. }
  33. if (ucs4 && !full) {