[liblouis-liblouisxml] Re: Crash in Python hyphenation

  • From: Christian Egli <christian.egli@xxxxxx>
  • To: Milan Zamazal <pdm@xxxxxxxxxxxx>
  • Date: Tue, 05 Jun 2012 11:15:38 +0200

Milan Zamazal <pdm@xxxxxxxxxxxx> writes:

>>>>>> "MW" == Michael Whapples <mwhapples@xxxxxxx> writes:
>
>     MW> Does lou_checkhyphens add a new line to the end of input?

Does the following patch help?

~/src/liblouis $ svn diff python/louis/__init__.py.in
Index: python/louis/__init__.py.in
===================================================================
--- python/louis/__init__.py.in (revision 666)
+++ python/louis/__init__.py.in (working copy)
@@ -262,7 +262,7 @@
     tablesString = _createTablesString(tableList)
     inbuf = createStr(inbuf)
     inlen = c_int(len(inbuf))
-    hyphen_string = create_string_buffer(inlen.value)
+    hyphen_string = create_string_buffer(inlen.value+1)
     if not liblouis.lou_hyphenate(tablesString, inbuf, inlen, hyphen_string, 
mode):
         raise RuntimeError("Can't hyphenate tables %s, inbuf %s, mode %d" 
%(tablesString, inbuf, mode))
     return hyphen_string.value.decode("ASCII")

-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

-----
Tag der offenen Tuer
Die SBS laedt Sie herzlich ein: 30. Juni 2012 von 9 bis 16 Uhr.
Mehr Informationen erhalten Sie unter www.sbs.ch/offenetuer
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: