From ec2c5619c1c402639dc80f9191f6031822344558 Mon Sep 17 00:00:00 2001 From: Dario Casalinuovo Date: Mon, 11 Apr 2016 12:56:48 +0200 Subject: [PATCH] AVFormatWriter: Add more error checking * Check before to write chunks if the header was correctly written, the same happens for track infos, even if the code doesn't support it. --- src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp index f4804c8853..017fde4b01 100644 --- a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp +++ b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp @@ -601,6 +601,9 @@ AVFormatWriter::AddTrackInfo(void* _cookie, uint32 code, TRACE("AVFormatWriter::AddTrackInfo(%lu, %p, %ld, %lu)\n", code, data, size, flags); + if (fHeaderError != 0) + return B_ERROR; + StreamCookie* cookie = reinterpret_cast(_cookie); return cookie->AddTrackInfo(code, data, size, flags); } @@ -613,6 +616,9 @@ AVFormatWriter::WriteChunk(void* _cookie, const void* chunkBuffer, TRACE_PACKET("AVFormatWriter::WriteChunk(%p, %ld, %p)\n", chunkBuffer, chunkSize, encodeInfo); + if (fHeaderError != 0) + return B_ERROR; + StreamCookie* cookie = reinterpret_cast(_cookie); return cookie->WriteChunk(chunkBuffer, chunkSize, encodeInfo); }