Mitigate Baron SameEdit (CVE-2021-3156) vulnerability

alpine 3.9
format weakness #1


Weakness Breakdown


A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.9 format weakness.

 	    if (buf[3] & 0x10)
		demux (data, end, (buf[1] & 0x40) ? DEMUX_PAYLOAD_START : 0);
    } while (packets == PACKETS);

static void es_loop (void)
    int size;
    do {
	size = fread (buffer, 1, BUFFER_SIZE, in_file);
	a52_decode_data (buffer, buffer + size);
    } while (size == BUFFER_SIZE);

int main (int argc, char ** argv)
    uint32_t accel;

#ifdef HAVE_IO_H
    setmode (fileno (stdout), O_BINARY);

    fprintf (stderr, PACKAGE"-"VERSION
	     " - by Michel Lespinasse <> and Aaron Holtzman\n");

    handle_args (argc, argv);

    accel = disable_accel ? 0 : MM_ACCEL_DJBFFT;

    output = ao_open (output_open);
    if (output == NULL) {
	fprintf (stderr, "Can not open output\n");
	return 1;

    state = a52_init (accel);
    if (state == NULL) {
	fprintf (stderr, "A52 init failed\n");
	return 1;

    if (demux_pid)
	ts_loop ();
    else if (demux_track)
	ps_loop ();
	es_loop ();

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.