summaryrefslogtreecommitdiff
path: root/upb/pb/compile_decoder_x64.dasc
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2015-08-11 17:46:31 -0700
committerJosh Haberman <jhaberman@gmail.com>2015-08-11 17:46:31 -0700
commit85440108e502b6f58671fcfc4b84103d1a716253 (patch)
tree87c6b186feb7b89fb84b3125653b0fe2d7ade339 /upb/pb/compile_decoder_x64.dasc
parentfe427341f29a31656e247ef528adbab5ad786c9e (diff)
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.
Diffstat (limited to 'upb/pb/compile_decoder_x64.dasc')
-rw-r--r--upb/pb/compile_decoder_x64.dasc13
1 files changed, 11 insertions, 2 deletions
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
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback