Fix off-by-one when parsing bytes32.

This commit is contained in:
Fang 2018-03-22 16:34:15 +01:00
parent 6fe0a29a55
commit b46315af11

View File

@ -194,7 +194,7 @@
|- ^+ das |- ^+ das
?~ tys (flop `(list data)`das) ?~ tys (flop `(list data)`das)
=* typ i.tys =* typ i.tys
?: (gte win (lent wos)) ~|(%insufficient-data !!) ?: (gte win (lent wos)) ~|([%insufficient-data tys] !!)
=- $(das [dat das], win nin, tys t.tys) =- $(das [dat das], win nin, tys t.tys)
::=< (decode-next win i.tys) ::TODO urbit/arvo#673 ::=< (decode-next win i.tys) ::TODO urbit/arvo#673
|^ ::|% ++ decode-next |= [win=@ud typ=etyp] |^ ::|% ++ decode-next |= [win=@ud typ=etyp]
@ -226,7 +226,7 @@
(decode-bytes-n +(lic) len) (decode-bytes-n +(lic) len)
:: ::
[%bytes-n *] [%bytes-n *]
:- (add win +((div n.typ 32))) :- (add win +((div (dec n.typ) 32)))
[%bytes-n (decode-bytes-n win n.typ)] [%bytes-n (decode-bytes-n win n.typ)]
:: ::
[%array *] [%array *]
@ -264,7 +264,7 @@
%^ end 3 (mul 2 bys) %^ end 3 (mul 2 bys)
%+ can 9 %+ can 9
%+ turn %+ turn
(swag [fro +((div bys 32))] wos) (swag [fro +((div (dec bys) 32))] wos)
|=(a=@t [1 a]) |=(a=@t [1 a])
:: ::
::TODO uncomment and use once urbit/arvo#673 gets resolved/a workaround. ::TODO uncomment and use once urbit/arvo#673 gets resolved/a workaround.