Branch: Tag:

2015-04-25

2015-04-25 13:10:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: Fixed NULL-deref on UNDEFINED. Fixes [CID 1294611].

934:    struct my_file *fd;    int once = 0;    -  if( _nbytes && (SUBTYPEOF(*_nbytes) == NUMBER_NUMBER) ) { +  if( _nbytes ) {    nbytes = _nbytes->u.integer;    if (!nbytes) RETURN 0;    }
1060:    io_range_error(io, sz);    sz = io_len(io);    } -  if( nbytes && (SUBTYPEOF(*nbytes) == NUMBER_NUMBER) ) +  if( nbytes )    sz = MINIMUM(nbytes->u.integer, sz);       if( TYPEOF(*f) == PIKE_T_OBJECT ) {
2481:    Buffer *this = THIS;    if( this->buffer )    Pike_error("Can not initialize twice.\n"); -  if( args == 0 ) +  if( !x )    {    this->buffer = xalloc(256-32);    this->allocated = 256-32;