Branch: Tag:


2018-11-04 10:50:40 by Tobias S. Josefowitz <>

Stdio.File()->read(): advance buffer if possible

This commit also removed Stdio.Buffer()->advance() because it
is a bad API. It allows one to 'validate' uninitialized memory
inside of Stdio.Buffer objects.

Instead, we now try to advance the write offset in Buffer objects
in Stdio.File()->read(), instead. This is done using a new internal
API which can be extended to advance other buffer types in the future.

1326:       bytes_read = do_read_into_buffer(fd, m.ptr, (size_t)m.len, &file->my_errno);    +  if (bytes_read > 0) +  pike_advance_memory_object(o, type, bytes_read); +     pop_n_elems(args);    push_int(bytes_read);    } else {