Skip to content

Some MPEG-2 streams result in corrupt width/height #360

@bvibber

Description

@bvibber

This is a followup to #359 where I was seeing divide-by-zero errors that I couldn't explain in MPEG videos.

I found a file that triggers the error condition; the problem seems to be that there are multiple blocks of data read out of the file, overwriting the data that's been loaded so far; initially getid3 correctly reads 720x480 but eventually it replaces it with 0x1, which was leading to the divide by zero when processing the aspect ratio.

Possibly there's a bad block at the end of the file? But ffpprobe -show_frames shows nothing out of the ordinary I could see.

Sample (about 800 MiB)
https://upload.wikimedia.org/wikipedia/commons/b/ba/Born_of_a_Dream_-_Extra_Feature.mpg

Repro:

<?php

require __DIR__ . '/vendor/autoload.php';

$files = ['Born_of_a_Dream_-_Extra_Feature.mpg'];
foreach ( $files as $path ) {
    echo "$path\n";

    // Create new id3 object:
    $getID3 = new getID3();

    // Don't grab stuff we don't use:
    // Read and process ID3v1 tags
    $getID3->option_tag_id3v1 = false;
    // Read and process ID3v2 tags
    $getID3->option_tag_id3v2 = false;
    // Read and process Lyrics3 tags
    $getID3->option_tag_lyrics3 = false;
    // Read and process APE tags
    $getID3->option_tag_apetag = false;
    // Copy tags to root key 'tags' and encode to $this->encoding
    $getID3->option_tags_process = false;
    // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
    $getID3->option_tags_html = false;

    // Analyze file to get metadata structure:
    $id3 = $getID3->analyze( $path );
}

Expected result: no error

Actual result: Divide By Zero fatal error (using the 3.0.19 composer release which doesn't have the workaround to prevent division error).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions