sile / jsone

Erlang JSON library
MIT License
291 stars 71 forks source link

Raise an error if a decode target JSON is followed by extra garbage chars. #69

Closed sile closed 2 years ago

sile commented 2 years ago

Before

> jsone:decode(<<"1@">>).
1

After

> jsone:decode(<<"1@">>).
** exception error: bad argument
     in function  jsone:check_decode_remainings/1
        called as jsone:check_decode_remainings(<<"@">>)
     in call from jsone:decode/2 (/home/tohta/dev/erlang/jsone/src/jsone.erl, line 338)

> jsone:decode(<<"1 \n">>).  % Whitespaces are still okay
1

Resolves #68

codecov-commenter commented 2 years ago

Codecov Report

Merging #69 (4c24e00) into master (5b8a858) will increase coverage by 0.47%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
+ Coverage   91.43%   91.91%   +0.47%     
==========================================
  Files           4        4              
  Lines         327      334       +7     
==========================================
+ Hits          299      307       +8     
+ Misses         28       27       -1     
Impacted Files Coverage Δ
src/jsone.erl 82.60% <100.00%> (+13.85%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5b8a858...4c24e00. Read the comment docs.