algorand / go-algorand

Algorand's official implementation in Go.
https://developer.algorand.org/
Other
1.35k stars 473 forks source link

load/store arg between -257 and 0 causes unhandled error upon compile #5217

Closed joe-p closed 1 year ago

joe-p commented 1 year ago

Subject of the issue

Passing an arg of load between -256 and 0 causes aglod to throw an unhandled error when compiling. The error manifests as ECONNRESET when hitting the compile endpoint.

Your environment

Latest sandbox on MacOS

12885819394
3.14.2.stable [rel/stable] (commit #8fd6e702)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand

Steps to reproduce

  1. Write valid TEAL program, with the exception of load -1
  2. Send program to /v2/compile

https://user-images.githubusercontent.com/50534337/225974317-ce8a0772-66b7-4b40-88bd-654314159b9b.mp4

Expected behaviour

A 400 response with the error message '1 error: 16: load unable to parse i "-1" as integer\n'

Actual behaviour

ECONNRESET

jannotti commented 1 year ago

Is this caused by all syntax errors? It would be surprising if this one particular syntax error has this effect and others did not.

joe-p commented 1 year ago

It's only if the arg is between -257 and 0. For example, load -1000 throws load unable to parse i "-1000" as integer\n' as one would expect