File: fix-fribidi-output-size.patch

package info (click to toggle)
marsshooter 0.7.6-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,812 kB
  • sloc: cpp: 20,216; xml: 29; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 896 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Description: Use correct output size for fribidi_unicode_to_charset
 The fribidi_unicode_to_charset writes a null terminating byte to the
 output string, so the output buffer needs to be one more than the size
 needed for the actual characters.
Author: James Cowgill <jcowgill@debian.org>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/Media/file.cpp
+++ b/src/Media/file.cpp
@@ -60,7 +60,7 @@ namespace file {
                 FriBidiParType base = FRIBIDI_PAR_LTR;
                 fribidi_log2vis(logical.data(), outSize, &base, visual.data(), NULL, NULL, NULL);
 
-                std::vector<char> outstring(outSize * 4, 0);
+                std::vector<char> outstring(outSize * 4 + 1, 0);
                 fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8, visual.data(), outSize, outstring.data());
 
                 line = std::string(outstring.data());