Copied from Debian. From: Kurt Roeckx Date: Sun, 28 Jan 2018 15:44:08 +0100 Subject: Check the size of the main data The main data to decode a frame can come from the current frame and part of the previous frame, the so called bit reservoir. si.main_data_begin is the part of the previous frame we need for this frame. frame_space is the amount of main data that can be in this frame, and next_md_begin is the part of this frame that is going to be used for the next frame. The maximum amount of data from a previous frame that the format allows is 511 bytes. The maximum frame size for the defined bitrates is at MPEG 2.5 layer 2 at 320 kbit/s and 8 kHz sample rate which gives 72 * (320000 / 8000) + 1 = 2881. So those defines are not large enough: # define MAD_BUFFER_GUARD 8 # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) There is also support for a "free" bitrate which allows you to create any frame size, which can be larger than the buffer. Changing the defines is not an option since it's part of the ABI, so we check that the main data fits in the bufer. The previous frame data is stored in *stream->main_data and contains stream->md_len bytes. If stream->md_len is larger than the data we need from the previous frame (si.main_data_begin) it still wouldn't fit in the buffer, so just keep the data that we need. Index: libmad-0.15.1b/layer3.c =================================================================== --- libmad-0.15.1b.orig/layer3.c +++ libmad-0.15.1b/layer3.c @@ -2608,6 +2608,11 @@ int mad_layer_III(struct mad_stream *str next_md_begin = 0; md_len = si.main_data_begin + frame_space - next_md_begin; + if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN) { + stream->error = MAD_ERROR_LOSTSYNC; + stream->sync = 0; + return -1; + } frame_used = 0; @@ -2625,8 +2630,11 @@ int mad_layer_III(struct mad_stream *str } } else { - mad_bit_init(&ptr, - *stream->main_data + stream->md_len - si.main_data_begin); + memmove(stream->main_data, + *stream->main_data + stream->md_len - si.main_data_begin, + si.main_data_begin); + stream->md_len = si.main_data_begin; + mad_bit_init(&ptr, *stream->main_data); if (md_len > si.main_data_begin) { assert(stream->md_len + md_len - og/gnu/installer/tests.scm?id=9090f7bf6999d56d9bc74669b2c839fd5739a250'>tests.scm
AgeCommit message (Expand)Author
2020-10-30installer: Use UUIDs in the 'swap-devices' field....Note: This change requires an updated 'guix' package that contains Linux-swap support in (gnu build file-systems). * gnu/installer/parted.scm (user-partitions->configuration): Use UUIDs in the 'swap-devices' field. * gnu/installer/newt/final.scm (run-final-page)[wait-for-clients]: New procedure. Use it. * gnu/installer/tests.scm (choose-partitioning): Wait for 'starting-final-step' message and move configuration file dialog handling to... (conclude-installation): ... here. Send over PORT the reply corresponding to 'starting-final-step'. * gnu/tests/install.scm (gui-test-program): When ENCRYPTED? is false, invoke 'swaplabel' in the marionette. (installation-target-os-for-gui-tests): When ENCRYPTED? is false, except a fixed UUID. Ludovic Courtès
2020-04-10installer: tests: Don't install to a CD/DVD....* gnu/installer/tests.scm (choose-partitioning): Use 'find' to select the disk. Ludovic Courtès
2020-03-26installer: tests: Use a filter to select desktop-environments....* gnu/installer/tests.scm (choose-services): Turn desktop-environments list into a choose-desktop-environment procedure. This way, it is easier to select all desktop-environments or none, in the same way as choose-network-service? and choose-network-management-tool? arguments. Mathieu Othacehe
2020-03-05tests: install: Add "gui-installed-os"....* gnu/installer/tests.scm: New file. * gnu/local.mk (INSTALLER_MODULES): Add it. * gnu/tests/install.scm (run-install): Add #:gui-test. Add (gnu installer tests) to the marionette imported modules. Honor GUI-TEST. Check whether SCRIPT is true. (%root-password, %syslog-conf): New variable. (operating-system-with-console-syslog, gui-test-program) (guided-installation-test): New procedures. (%extra-packages, installation-os-for-gui-tests) (%test-gui-installed-os): New variable. Ludovic Courtès