From 85440108e502b6f58671fcfc4b84103d1a716253 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Tue, 11 Aug 2015 17:46:31 -0700 Subject: More decoder fixes, and slightly changed parse call semantics. Prior to this change, if an error was returned, it would be guaranteed to always return a short byte count. Now the two concepts are a bit more orthogonal. There are cases where the entire input is consumed even though an error was encountered. --- upb/pb/compile_decoder_x64.dasc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'upb/pb/compile_decoder_x64.dasc') diff --git a/upb/pb/compile_decoder_x64.dasc b/upb/pb/compile_decoder_x64.dasc index dfc9597..edda7dd 100644 --- a/upb/pb/compile_decoder_x64.dasc +++ b/upb/pb/compile_decoder_x64.dasc @@ -300,7 +300,7 @@ static void emit_static_asm(jitcompiler *jc) { | mov rcx, DELIMEND | sub rcx, PTR | sub rcx, rdx - | jb ->err // Len is greater than enclosing message. + | jb >4 // Len is greater than enclosing message. | mov FRAME->end_ofs, rcx | cmp FRAME, DECODER->limit | je >3 // Stack overflow @@ -319,7 +319,7 @@ static void emit_static_asm(jitcompiler *jc) { |2: | ret |3: - | // Error -- call seterr. + | // Stack overflow error. | mov PTR, DECODER->checkpoint // Rollback to before the delim len. | // Prepare seterr args. | mov ARG1_64, DECODER @@ -327,6 +327,15 @@ static void emit_static_asm(jitcompiler *jc) { | callp upb_pbdecoder_seterr | call ->suspend | jmp <1 + |4: + | // Overextended len. + | mov PTR, DECODER->checkpoint // Rollback to before the delim len. + | // Prepare seterr args. + | mov ARG1_64, DECODER + | ld64 kPbDecoderSubmessageTooLong + | callp upb_pbdecoder_seterr + | call ->suspend + | jmp <1 | | // For getting a value that spans a buffer seam. Falls back to C. |.macro getvalue_slow, func, bytes -- cgit v1.2.3