Prevent endless loop in error case.

This commit is contained in:
Volker Berlin 2017-03-26 11:41:21 +02:00
parent 43cb89f546
commit 527f3d2bc7

View File

@ -69,6 +69,9 @@ class WasmOutputStream extends FilterOutputStream {
* if an I/O error occurs.
*/
void writeVaruint32( @Nonnegative int value ) throws IOException {
if( value < 0 ) {
throw new IOException( "Invalid negative value" );
}
do {
int b = value & 0x7F; // low 7 bits
value >>= 7;