-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
A decoder I wrote returned Nothing for large byte sequences, but it was due to a stack overflow in a Bytes.Decode.map function I used.
Here's a simple example:
import Bytes.Decode as D
import Bytes.Encode as E
-- This causes a stack overflow for any input
stackOverflow x =
case [x] of
hd :: _ ->
hd :: stackOverflow x
[] ->
[]
-- This is a single byte (00000001)
byte = E.unsignedInt8 1
-- This decoder should raise an exception
overflowDecoder = D.map stackOverflow D.unsignedInt8> stackOverflow 1
RangeError: Maximum call stack size exceeded
> D.decode overflowDecoder byte
Nothing
Viir
Metadata
Metadata
Assignees
Labels
No labels