mvdan / sh

A shell parser, formatter, and interpreter with bash support; includes shfmt
https://pkg.go.dev/mvdan.cc/sh/v3
BSD 3-Clause "New" or "Revised" License
7.2k stars 340 forks source link

Divide by zero fails unrecoverably #997

Closed bimargulies-google closed 1 year ago

bimargulies-google commented 1 year ago

if arith.go divides by zero., the result is unrecoverable, unlike other code in this area which returns errors.

binArith could have a recover() handler to return an error when arithmetic is impossible. I would be happy to contribute if it would be accepted.

bimargulies-google commented 1 year ago

I was reading an ancient version. Apologies.