Menu

#260 Reading from memory files depends upon uninitialized value read

closed-fixed
nobody
None
5
2020-08-04
2015-03-18
No

sox_open_mem_read creates a file using fmemopen, and in the method is_seekable in formats.c, sox is calling
fstat(fileno((FILE*)ft->fp), &st);
this is failing with an error of bad file handle which is being ignored and leaving st in an uninitialized/undefined state.

From the NOTES section of man fmemopen:
There is no file descriptor associated with the file stream returned by
these functions (i.e., fileno(3) will return an error if called on the
returned stream).

This means that is_seekable can return an unpredictable result. fmemopen files do support seeking, so there is no specific harm here, although some tools that report uninitialized accesses trigger.

Discussion

  • Stefan Sauer

    Stefan Sauer - 2015-06-24
     
  • Mans Rullgard

    Mans Rullgard - 2020-08-04
    • status: open --> closed-fixed
     
  • Mans Rullgard

    Mans Rullgard - 2020-08-04

    Fixed.

     

Log in to post a comment.