It appears that whatever previous prevented me from using the rebar3
port_compiler is no longer an issue. This change allows rebar2 and
rebar3 compilation by relying on port_compiler for rebar3 and
reverting to standard rebar2 otherwise.
The recent release of Erlang 23.0 removed support for loading beam
modules compiled under R14 and earlier. Thus we're now forced to abandon
support for R13 and R14.
This bug was due to an interaction between two optimizations. If we
attempt to flush the buffer before any bytes are used we refused.
However, in enc_ensure we were not checking whether the buffer was
actually flushed so we would allocate a new buffer for the request.
The easiest way to encounter this issue was by encoding a raw binary
longer than 2041 bytes (i.e., `jiffy:encode(<<"stuff...">>).`).
If the input contained a mismatched end-of-array/object, the stack
could become empty before a call to dec_curr, which would look
beyond the bounds of the stack. If the value at this invalid
position happened to be st_array, we would pop too much from the
stack and overwrite the data that came before it.
This commit fixes this by letting dec_pop return the previous
state or st_invalid if the stack is empty, letting us exit
gracefully if the state isn't what we expect it to be.
dec_pop_assert is identical to the old dec_pop, tearing down the
emulator on internal errors.