Files
id3lib/id3lib-3.8.3-fix-utf16-stringlists.patch
Tomáš Chvátal b1dc577eea - Add patch from debian to fix utf string lists:
* id3lib-3.8.3-fix-utf16-stringlists.patch
- Add patch to add wrappers for field encoding:
  * add-c-wrapper-functions.patch
- Add patch to fix null pointer check:
  * id3lib-missing-nullpointer-check.patch

- Rename patch id3lib-3.8.3-fix-stack-overrun to
  id3lib-3.8.3-fix-stack-overrun.patch in order to keep the name
  sane

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/id3lib?expand=0&rev=23
2019-10-11 10:19:40 +00:00

25 lines
946 B
Diff

Based on a Debian patch by Urs Fleisch <urs.fleisch@gmail.com>
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680915
Index: id3lib-3.8.3/src/io_helpers.cpp
===================================================================
--- id3lib-3.8.3.orig/src/io_helpers.cpp
+++ id3lib-3.8.3/src/io_helpers.cpp
@@ -364,10 +364,17 @@ size_t io::writeUnicodeText(ID3_Writer&
unicode_t BOM = 0xFEFF;
writer.writeChars((const unsigned char*) &BOM, 2);
unsigned char *pdata = (unsigned char *) data.c_str();
+ unicode_t lastCh = BOM;
for (size_t i = 0; i < size; i += 2)
{
unicode_t ch = (pdata[i] << 8) | pdata[i+1];
+ if (lastCh == 0 && ch != BOM)
+ {
+ // Last character was NULL, so start next string with BOM.
+ writer.writeChars((const unsigned char*) &BOM, 2);
+ }
writer.writeChars((const unsigned char*) &ch, 2);
+ lastCh = ch;
}
}
return writer.getCur() - beg;