{"id":1637,"date":"2017-04-11T13:35:06","date_gmt":"2017-04-11T11:35:06","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1637"},"modified":"2017-04-17T19:18:29","modified_gmt":"2017-04-17T17:18:29","slug":"libsamplerate-global-buffer-overflow-in-calc_output_single-src_sinc-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/11\/libsamplerate-global-buffer-overflow-in-calc_output_single-src_sinc-c\/","title":{"rendered":"libsamplerate: global buffer overflow in calc_output_single (src_sinc.c)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/www.mega-nerd.com\/SRC\/\">libsamplerate<\/a> is a Sample Rate Converter for audio.<\/p>\n<p>This bug was initially discovered and silently fixed by the upstream author Erik de Castro Lopo (erikd). As usual I&#8217;m providing the stacktrace and the reproducer so that all release distros can test and patch their own version of the package.<\/p>\n<pre><font size=\"2\"># sndfile-resample -to 24000 -c 1 $FILE out\r\n==13807==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f44bc709a3c at pc 0x7f44bc6b1d6b bp 0x7fffec8f5e20 sp 0x7fffec8f5e18                                                                       \r\nREAD of size 4 at 0x7f44bc709a3c thread T0                                                                                                                                                                        \r\n    #0 0x7f44bc6b1d6a in calc_output_single \/tmp\/portage\/media-libs\/libsamplerate-0.1.8-r1\/work\/libsamplerate-0.1.8\/src\/src_sinc.c:296:48                                                                         \r\n    #1 0x7f44bc6b1d6a in sinc_mono_vari_process \/tmp\/portage\/media-libs\/libsamplerate-0.1.8-r1\/work\/libsamplerate-0.1.8\/src\/src_sinc.c:400                                                                        \r\n    #2 0x7f44bc6a3659 in src_process \/tmp\/portage\/media-libs\/libsamplerate-0.1.8-r1\/work\/libsamplerate-0.1.8\/src\/samplerate.c:174:11                                                                              \r\n    #3 0x51369a in sample_rate_convert \/tmp\/portage\/media-libs\/libsamplerate-0.1.8-r1\/work\/libsamplerate-0.1.8\/examples\/sndfile-resample.c:221:16                                                                 \r\n    #4 0x51369a in main \/tmp\/portage\/media-libs\/libsamplerate-0.1.8-r1\/work\/libsamplerate-0.1.8\/examples\/sndfile-resample.c:163                                                                                   \r\n    #5 0x7f44bb55278f in __libc_start_main \/tmp\/portage\/sys-libs\/glibc-2.23-r3\/work\/glibc-2.23\/csu\/..\/csu\/libc-start.c:289                                                                                        \r\n    #6 0x419f88 in _init (\/usr\/bin\/sndfile-resample+0x419f88)                                                                                                                                                     \r\n                                                                                                                                                                                                                  \r\n0x7f44bc709a3c is located 0 bytes to the right of global variable 'slow_mid_qual_coeffs' defined in '\/tmp\/portage\/media-libs\/libsamplerate-0.1.8-r1\/work\/libsamplerate-0.1.8\/src\/mid_qual_coeffs.h:37:3' (0x7f44bc6f3ba0) of size 89756                                                                                                                                                                                             \r\nSUMMARY: AddressSanitizer: global-buffer-overflow \/tmp\/portage\/media-libs\/libsamplerate-0.1.8-r1\/work\/libsamplerate-0.1.8\/src\/src_sinc.c:296:48 in calc_output_single                                             \r\nShadow bytes around the buggy address:                                                                                                                                                                            \r\n  0x0fe9178d92f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                                                                                                 \r\n  0x0fe9178d9300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                                                                                                 \r\n  0x0fe9178d9310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                                                                                                 \r\n  0x0fe9178d9320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                                                                                                 \r\n  0x0fe9178d9330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                                                                                                 \r\n=&gt;0x0fe9178d9340: 00 00 00 00 00 00 00[04]f9 f9 f9 f9 f9 f9 f9 f9                                                                                                                                                 \r\n  0x0fe9178d9350: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9                                                                                                                                                 \r\n  0x0fe9178d9360: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9                                                                                                                                                 \r\n  0x0fe9178d9370: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9                                                                                                                                                 \r\n  0x0fe9178d9380: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9                                                                                                                                                 \r\n  0x0fe9178d9390: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9                                                                                                                                                 \r\nShadow byte legend (one shadow byte represents 8 application bytes):                                                                                                                                              \r\n  Addressable:           00                                                                                                                                                                                       \r\n  Partially addressable: 01 02 03 04 05 06 07                                                                                                                                                                     \r\n  Heap left redzone:       fa                                                                                                                                                                                     \r\n  Freed heap region:       fd                                                                                                                                                                                     \r\n  Stack left redzone:      f1                                                                                                                                                                                     \r\n  Stack mid redzone:       f2                                                                                                                                                                                     \r\n  Stack right redzone:     f3                                                                                                                                                                                     \r\n  Stack after return:      f5\r\n  Stack use after scope:   f8\r\n  Global redzone:          f9\r\n  Global init order:       f6\r\n  Poisoned by user:        f7\r\n  Container overflow:      fc\r\n  Array cookie:            ac\r\n  Intra object redzone:    bb\r\n  ASan internal:           fe\r\n  Left alloca redzone:     ca\r\n  Right alloca redzone:    cb\r\n==13807==ABORTING\r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n1.0.8<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\n1.0.9<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\nN\/A<\/p>\n<p><strong>Credit:<\/strong><br \/>\nThis bug was discovered by Erik de Castro Lopo and Agostino Sarubbo.<\/p>\n<p><strong>CVE:<\/strong><br \/>\nCVE-2017-7697<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00262-libsamplerate-globaloverflow-calc_output_single\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00262-libsamplerate-globaloverflow-calc_output_single<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-04-11: bug discovered and reported to upstream<br \/>\n2017-04-11: blog post about the issue<br \/>\n2017-04-12: 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=\"FJr2l9nVin\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/04\/11\/libsamplerate-global-buffer-overflow-in-calc_output_single-src_sinc-c\/\">libsamplerate: global buffer overflow in calc_output_single (src_sinc.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\/11\/libsamplerate-global-buffer-overflow-in-calc_output_single-src_sinc-c\/embed\/#?secret=FJr2l9nVin\" data-secret=\"FJr2l9nVin\" width=\"600\" height=\"338\" title=\"&#8220;libsamplerate: global buffer overflow in calc_output_single (src_sinc.c)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: libsamplerate is a Sample Rate Converter for audio. This bug was initially discovered and silently fixed by the upstream author Erik de Castro Lopo (erikd). As usual I&#8217;m providing the stacktrace and the reproducer so that all release distros &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/04\/11\/libsamplerate-global-buffer-overflow-in-calc_output_single-src_sinc-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-qp","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1637"}],"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=1637"}],"version-history":[{"count":5,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1637\/revisions"}],"predecessor-version":[{"id":1654,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1637\/revisions\/1654"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}