[PATCH] Fixed out of bounds memory access

Stephan Bergmann sbergman at redhat.com
Thu Jun 21 00:28:38 PDT 2012


On 06/20/2012 10:22 PM, Caolán McNamara wrote:
> I wonder if there would be any actual measurable performance benefit to
> sticking in some hackery to keep the rtl_str_getLength symbol for
> backwards compatibility but alias/define rtl_str_getLength to strlen in
> order to get any benefit of those optimized strlens.

My gut assumption is that it wouldn't make too much of a difference in 
practice.  (Do we have large amounts of calls to rtl_str_getLength to 
begin with?)

And it would shoot down the valgrind workaround.  ;)

 > Or do they only
> kick in if the compiler can determine locally that the argument comes
> from malloc ? dunno.

The actual optimization is likely (only) to read in complete words 
rather than individual bytes, which can be applied independently of the 
provenance of the argument.  (In fact, a compiler could even 
automatically optimize the implementation of rtl_str_getLength in that way.)

Stephan


More information about the LibreOffice mailing list