patch-utf16_c 701 B

123456789101112131415161718192021
  1. --- libid3tag-0.15.1b.orig/utf16.c 2004-01-23 10:41:32.000000000 +0100
  2. +++ libid3tag-0.15.1b/utf16.c 2013-10-16 12:34:27.000000000 +0200
  3. @@ -282,5 +282,18 @@ id3_ucs4_t *id3_utf16_deserialize(id3_by
  4. free(utf16);
  5. + if (end == *ptr && length % 2 != 0)
  6. + {
  7. + /* We were called with a bogus length. It should always
  8. + * be an even number. We can deal with this in a few ways:
  9. + * - Always give an error.
  10. + * - Try and parse as much as we can and
  11. + * - return an error if we're called again when we
  12. + * already tried to parse everything we can.
  13. + * - tell that we parsed it, which is what we do here.
  14. + */
  15. + (*ptr)++;
  16. + }
  17. +
  18. return ucs4;
  19. }