{"id":1677,"date":"2017-04-29T15:21:09","date_gmt":"2017-04-29T13:21:09","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1677"},"modified":"2017-05-01T13:21:07","modified_gmt":"2017-05-01T11:21:07","slug":"libsndfile-invalid-memory-read-in-flac_buffer_copy-flac-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/29\/libsndfile-invalid-memory-read-in-flac_buffer_copy-flac-c\/","title":{"rendered":"libsndfile: invalid memory read in flac_buffer_copy (flac.c)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/www.mega-nerd.com\/libsndfile\">libsndfile<\/a> is a C library for reading and writing files containing sampled sound.<\/p>\n<p>The complete ASan output of the issue:<\/p>\n<pre><font size=\"2\"># sndfile-resample -to 24000 -c 1 $FILE out\r\n==19624==ERROR: AddressSanitizer: SEGV on unknown address 0x000000004000 (pc 0x7fe14fe3f2b3 bp 0x000000004000 sp 0x7ffcb49c4d50 T0)                                                                               \r\n==19624==The signal is caused by a READ memory access.                                                                                                                                                            \r\n    #0 0x7fe14fe3f2b2 in flac_buffer_copy \/tmp\/portage\/media-libs\/libsndfile-1.0.28\/work\/libsndfile-1.0.28\/src\/flac.c:287                                                                                         \r\n    #1 0x7fe14fe403d7 in flac_read_loop \/tmp\/portage\/media-libs\/libsndfile-1.0.28\/work\/libsndfile-1.0.28\/src\/flac.c:928                                                                                           \r\n    #2 0x7fe14fe404d4 in flac_read_flac2f \/tmp\/portage\/media-libs\/libsndfile-1.0.28\/work\/libsndfile-1.0.28\/src\/flac.c:999                                                                                         \r\n    #3 0x7fe14fe34925 in sf_readf_float \/tmp\/portage\/media-libs\/libsndfile-1.0.28\/work\/libsndfile-1.0.28\/src\/sndfile.c:1945                                                                                       \r\n    #4 0x50a525 in sample_rate_convert \/tmp\/portage\/media-libs\/libsamplerate-0.1.9\/work\/libsamplerate-0.1.9\/examples\/sndfile-resample.c:206:29                                                                    \r\n    #5 0x50a525 in main \/tmp\/portage\/media-libs\/libsamplerate-0.1.9\/work\/libsamplerate-0.1.9\/examples\/sndfile-resample.c:156                                                                                      \r\n    #6 0x7fe14ef70680 in __libc_start_main \/tmp\/portage\/sys-libs\/glibc-2.23-r3\/work\/glibc-2.23\/csu\/..\/csu\/libc-start.c:289                                                                                        \r\n    #7 0x419fa8 in _init (\/usr\/bin\/sndfile-resample+0x419fa8)                                                                                                                                                     \r\n                                                                                                                                                                                                                  \r\nAddressSanitizer can not provide additional info.                                                                                                                                                                 \r\nSUMMARY: AddressSanitizer: SEGV \/tmp\/portage\/media-libs\/libsndfile-1.0.28\/work\/libsndfile-1.0.28\/src\/flac.c:287 in flac_buffer_copy                                                                               \r\n==19624==ABORTING\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n1.0.28<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\nN\/A<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/erikd\/libsndfile\/commit\/ef1dbb2df1c0e741486646de40bd638a9c4cd808\">https:\/\/github.com\/erikd\/libsndfile\/commit\/ef1dbb2df1c0e741486646de40bd638a9c4cd808<\/a><\/p>\n<p><strong>Credit:<\/strong><br \/>\nThis bug was discovered by Agostino Sarubbo of Gentoo.<\/p>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2017-8362<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00264-libsndfile-invalidread-flac_buffer_copy\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00264-libsndfile-invalidread-flac_buffer_copy<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-04-12: bug discovered and reported to upstream<br \/>\n2017-04-14: upstream released a patch<br \/>\n2017-04-29: blog post about the issue<br \/>\n2017-04-30: CVE assigned<\/p>\n<p><strong>Note:<\/strong><br \/>\nThis bug was found with <a href=\"http:\/\/lcamtuf.coredump.cx\/afl\">American Fuzzy Lop<\/a>.<\/p>\n<p><strong>Permalink:<\/strong><\/p>\n<blockquote data-secret=\"Pm6AkR7NYy\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/04\/29\/libsndfile-invalid-memory-read-in-flac_buffer_copy-flac-c\/\">libsndfile: invalid memory read in flac_buffer_copy (flac.c)<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/blogs.gentoo.org\/ago\/2017\/04\/29\/libsndfile-invalid-memory-read-in-flac_buffer_copy-flac-c\/embed\/#?secret=Pm6AkR7NYy\" data-secret=\"Pm6AkR7NYy\" width=\"600\" height=\"338\" title=\"&#8220;libsndfile: invalid memory read in flac_buffer_copy (flac.c)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: libsndfile is a C library for reading and writing files containing sampled sound. The complete ASan output of the issue: # sndfile-resample -to 24000 -c 1 $FILE out ==19624==ERROR: AddressSanitizer: SEGV on unknown address 0x000000004000 (pc 0x7fe14fe3f2b3 bp 0x000000004000 &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/29\/libsndfile-invalid-memory-read-in-flac_buffer_copy-flac-c\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":140,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[12,10],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2EaBc-r3","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1677"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/users\/140"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/comments?post=1677"}],"version-history":[{"count":2,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1677\/revisions"}],"predecessor-version":[{"id":1731,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1677\/revisions\/1731"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}