Skip to content

Commit

Permalink
[bug] prevent bjdata/ubjson from parsing closing bracket when count #…
Browse files Browse the repository at this point in the history
… presents
  • Loading branch information
fangq committed Jan 15, 2025
1 parent c43e30b commit 8d911de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions loadbj.m
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,13 @@
[val, pos] = parse_value(inputstr, pos, [], varargin{:});
end
object{end + 1} = val;
[cc, pos] = next_char(inputstr, pos);
if cc == ']'
if count > 0 && length(object) >= count
break
else
[cc, pos] = next_char(inputstr, pos);
if cc == ']' || (count > 0 && length(object) >= count)
break
end
end
end
end
Expand Down

0 comments on commit 8d911de

Please sign in to comment.