Branch: Tag:

2014-10-09

2014-10-09 11:49:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Handle UNDEFINED nbytes in input_from().

The nbytes argument may be UNDEFINED (typically when the once argument
has been specified). Handle it as if nbytes hasn't been specified.

Thanks to Stephen R. van den Berg <srb@cuci.nl> for the report.

Fixes some of [LysLysKOM 20998397]/[Pike mailinglist 14064].

908:    struct my_file *fd;    int once = 0;    -  if( _nbytes ) { +  if( _nbytes && (SUBTYPEOF(*_nbytes) == NUMBER_NUMBER) ) {    nbytes = _nbytes->u.integer;    if (!nbytes) RETURN 0;    }
1034:    io_range_error(io, sz);    sz = io_len(io);    } -  if( nbytes ) +  if( nbytes && (SUBTYPEOF(*nbytes) == NUMBER_NUMBER) )    sz = MINIMUM(nbytes->u.integer, sz);       if( TYPEOF(*f) == PIKE_T_OBJECT ) {