Hanno Böck <hanno@hboeck.de>


Found
r1722860

r1722860 | stefan2 | 2016-01-04 06:41:58 -0600 (Mon, 04 Jan 2016)

Fix access to uninitialized memory in our UTF8 validity checker.
For static strings like "", this violated C99, 6.2.4.5 and 3.17.2.

The code path for C strings only fully worked for APR allocated memory
and could fail otherwise on systems with fine-grained boundary checks.

This patch simply eliminates the C string specific implementation and
reuses the equally efficient svn_utf__last_valid function.  Calling
strlen is not an added overhead here:  If the string is ASCII-7 only,
strlen is about as efficient as first_non_fsm_start_char_cstring's
implicit EOS check.  If the string contains chars >= 0x80, the much
more expensive state machine code will dominate the runtime.

Reported by: Hanno Böck <hanno{_AT_}hboeck.de>

* subversion/libsvn_subr/utf_validate.c
  (first_non_fsm_start_char_cstring): Remove because it is no longer used. 
  (svn_utf__cstring_is_valid): Implement in terms of svn_utf__last_valid.