kogmbh/WebODF — pull request #541 by peitschie (2014-04-14 06:31:33+00:00)
Title: Fix crash in utf8ByteArrayToString when opening UTF8 heavy docs

UTF8 allows double-byte chars (as shown in the loop handling behaviour). This means that it's possible for the number of chars to never be exactly 1000. E.g., a double-byte char is added after there are 999 chars. If this happens, the char length will never flush until the function returns, at which point too many arguments are passed into the apply invocation and a maximum stack size error will be thrown.

There is no measurable performance from this change (tested @ 1000pages.odt)