[liblouis-liblouisxml] Re: Crash in Python hyphenation

  • From: James Teh <jamie@xxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 06 Jun 2012 08:17:41 +1000

On 5/06/2012 10:36 PM, Milan Zamazal wrote:
     CE> Does the following patch help?
It doesn't but if the given line is changed to
   hyphen_string = create_string_buffer(inlen.value+2)
then it works on all words in my document.
I guess you can explain this if liblouis doesn't handle inlen properly. The input string probably has 16 bit characters on this system (including the NULL character), so the NULL character is 2 bytes. We should use:
inlen.value + sizeof(c_wchar)
I think this is really a bug in liblouis, though. The documentation says the output buffer must be of size inlen, so it shouldn't write past inlen.

Jamie

--
James Teh
Director, NV Access Limited
Email: jamie@xxxxxxxxxxxx
Web site: http://www.nvaccess.org/
Phone: +61 7 5667 8372


For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: