fix buffer overflow of wrap_buffer (may fix #5221)
authorRobin Gareus <robin@gareus.org>
Sun, 23 Dec 2012 14:25:12 +0000 (14:25 +0000)
committerRobin Gareus <robin@gareus.org>
Sun, 23 Dec 2012 14:25:12 +0000 (14:25 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@13715 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audio_diskstream.cc

index d8f2ba9d746072d9423cacaac0dee5ebd9b4611f..dc9f427e87bea04d5f13c081ac657214a5ba4619 100644 (file)
@@ -618,7 +618,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, framecn
                                           as our current_playback_buffer.
                                        */
 
-                                       assert(wrap_buffer_size >= chaninfo->playback_vector.len[0] + chaninfo->playback_vector.len[1]);
+                                       assert(wrap_buffer_size >= necessary_samples);
 
                                        /* Copy buf[0] from playback_buf */
                                        memcpy ((char *) chaninfo->playback_wrap_buffer,
@@ -1954,7 +1954,7 @@ AudioDiskstream::allocate_temporary_buffers ()
        */
 
        double const sp = max (fabsf (_actual_speed), 1.2f);
-       framecnt_t required_wrap_size = (framecnt_t) floor (_session.get_block_size() * sp) + 1;
+       framecnt_t required_wrap_size = (framecnt_t) ceil (_session.get_block_size() * sp) + 2;
 
        if (required_wrap_size > wrap_buffer_size) {