Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6595 closed bug (fixed)

ffmpeg plugin's AVFormatReader crashes if given a file it can't handle.

Reported by: scottmc Owned by: stippi
Priority: normal Milestone: R1
Component: Audio & Video/Codecs Version: R1/Development
Keywords: ffmpeg media codec sniff Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description (last modified by phoudoin)

Instead of rejecting a file that it can't handle, FFMPEG plugin AVFormatReader crash in Sniff() cleanup.

Attachments (2)

crashffmpeg.png (201.3 KB ) - added by Barrett 9 years ago.
ffmpeg plugin crash
ffmpeg.patch (512 bytes ) - added by Barrett 9 years ago.
Very little patch to solve the ticket 6595.

Download all attachments as: .zip

Change History (15)

comment:1 by yourpalal, 9 years ago

This crash happens when creating a BAlert in MediaConverterApp::RefsReceived(). This is not the same as issue as #6497.

comment:2 by Barrett, 9 years ago

i'll have free time in the next weekend...i'll work on this ticket if no one is interested : )

in reply to:  2 comment:3 by yourpalal, 9 years ago

Replying to Barrett:

i'll have free time in the next weekend...i'll work on this ticket if no one is interested : )

Sounds good, thanks!

comment:4 by Barrett, 9 years ago

Before of the BAlert problem there's a blocking bug on the ffmpeg plugin, this happens when is passed a file that it can't handle. Removing the ffmpeg plugin "solve" the problem. I don't know what is the best way to fix that...maybe checking if AVFormatReader::Reader::fSource is a media file through BNode? i think it need a look by a more experienced developer to get me on the right way.

by Barrett, 9 years ago

Attachment: crashffmpeg.png added

ffmpeg plugin crash

comment:5 by phoudoin, 9 years ago

Component: Applications/MediaConverterAudio & Video/Codecs
Description: modified (diff)
Keywords: ffmpeg media codec sniff added
Owner: changed from nobody to stippi
Status: newassigned
Summary: MediaConverter crashes if given a file it can't handle.ffmpeg plugin's AVFormatReader crashes if given a file it can't handle.

Reproduced here. Seems, indeed, not a MediaConverter issue but a crashing condition in ffmpeg's AVFormatReader::Sniff() cleanup on unknown file.

in reply to:  5 comment:6 by yourpalal, 9 years ago

Replying to phoudoin:

Reproduced here. Seems, indeed, not a MediaConverter issue but a crashing condition in ffmpeg's AVFormatReader::Sniff() cleanup on unknown file.

Actually, at the time I created this ticket (hrev38346), the ffmpeg plugin was not crashing, but in fact the BAlert constructor was (or something to that effect). Perhaps the two are related, but it was, IIRC a different crash.

comment:7 by Barrett, 9 years ago

The BAlert problem is still present, but it do not happens always and you should at least filter for media files or the ffmpeg crash will hide that.

http://img40.imageshack.us/img40/9034/crashbalert.png

comment:8 by Barrett, 9 years ago

Looking at the code, i found the problem (maybe) :

The struct fIOContext has a member named buffer, it is initialized at StreamBase::Open() line 297, since the file we are trying to read is not a media file the function av_probe_input_format() fail and the code after line 283 is not executed. There's a delete for fIOContext.buffer in ~StreamBase(), the Stream is deleted by an AutoDeleter in AVFormatReader::Sniff() (see the screenshot). Setting fIOContext.buffer to NULL in StreamBase() seems to solve the ffmpeg problem (but not the BAlert one)...if anyone give me a feedback i can make the patch...i'm not sure if my remarks are right.

by Barrett, 9 years ago

Attachment: ffmpeg.patch added

Very little patch to solve the ticket 6595.

comment:9 by phoudoin, 9 years ago

Applied in hrev39374. Thanks.

comment:10 by stippi, 9 years ago

Resolution: fixed
Status: assignedclosed

Thanks everyone involved! Assuming the ticket is fixed and was only not closed due to hidden "Modify ticket" controls...

comment:11 by anevilyak, 9 years ago

I think the only open question was if the BAlert problem mentioned earlier still occurs, but if it does it probably merits a separate ticket anyways.

comment:12 by Barrett, 9 years ago

As mentioned the BAlert crash is still alive. I'm investigating on that, i hope to get the bug fixed tomorrow (or in some days at least)..maybe a new ticket is not needed.

comment:13 by Barrett, 9 years ago

The problem disappeared when i updated libmedia.so from rev39350 to the mine installation (hrev39160). I really don't know why, maybe the cause was the difference of libmedia versions. On the latest image from haiku files the problem seems fixed also. I'm preparing a patch with little improvements for MediaConverter and ffmpeg.

Note: See TracTickets for help on using tickets.