More nEndInvalid/COMPLETE_STRING fixes

...to fix -fsanitize=signed-integer-overflow

Change-Id: Ib8dad09f1ed088c51fb417efecf662e76b2e495a