Skip to content

Commit

Permalink
Fixing #13559 with more limited impact. Performance should be identic…
Browse files Browse the repository at this point in the history
…al to baseline.

Fixed infinite loop in previous fix for #13559.

Do not throw EOFError if buffer already contains n bytes. #13559

(cherry picked from commit 68442e2)
ref #13638
  • Loading branch information
hessammehr authored and tkelman committed Nov 29, 2015
1 parent f40a611 commit 8662eec
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,13 @@ static void NORETURN throw_eof_error(void)
DLLEXPORT uint64_t jl_ios_get_nbyte_int(ios_t *s, const size_t n)
{
assert(n <= 8);
size_t ret = ios_readprep(s, n);
if (ret < n)
throw_eof_error();
size_t space, ret;
do {
space = s->size - s->bpos;
ret = ios_readprep(s, n);
if (space == ret && ret < n)
throw_eof_error();
} while(ret < n);
uint64_t x = 0;
uint8_t *buf = (uint8_t*)&s->buf[s->bpos];
if (n == 8) {
Expand Down

0 comments on commit 8662eec

Please sign in to comment.