Skip to content

Commit 8d911de

Browse files
committed
[bug] prevent bjdata/ubjson from parsing closing bracket when count # presents
1 parent c43e30b commit 8d911de

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

loadbj.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,13 @@
302302
[val, pos] = parse_value(inputstr, pos, [], varargin{:});
303303
end
304304
object{end + 1} = val;
305-
[cc, pos] = next_char(inputstr, pos);
306-
if cc == ']'
305+
if count > 0 && length(object) >= count
307306
break
307+
else
308+
[cc, pos] = next_char(inputstr, pos);
309+
if cc == ']' || (count > 0 && length(object) >= count)
310+
break
311+
end
308312
end
309313
end
310314
end

0 commit comments

Comments
 (0)