Date: Thu, 8 Oct 2015 18:12:56 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: open_memstream corner case On Tue, Oct 06, 2015 at 04:52:58PM +0300, Maxim Storchak wrote: > Hi, > > I discovered something strange with memstream subsystem in musl: if a > stream is opened for writing with open_memstream(3) but then closed > without writing anything, neither buffer pointer, nor buffer size gets > updated. I compared source code of glibc, uClibc and musl and discovered > that both uClibc and musl update buffer size on write, while glibc does > that on fclose or fsync, both of which is fine, according to > memstream(3) man page. While both uClibc and musl behave the same if > something is written to the buffer, they differ if no write happens. On > initialization uClibc sets buffer size to 0, and musl leaves it intact. > In case of no write it doesn't get updated and contains garbage. Here is > my test case: Thank you for the detailed report and test case. The bug should now be fixed by commit 7b9f57f207b51132f188f750161953b7baf32154. Please let me know if any problems remain or if you find other issues. Here is the commit link in case you want to apply it manually to an older version: http://git.musl-libc.org/cgit/musl/commit/?id=7b9f57f207b51132f188f750161953b7baf32154 Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.