Maarten Lankhorst : quartz: Small mpeg splitter fixes.

Alexandre Julliard julliard at winehq.org
Tue Apr 1 16:44:14 CDT 2008


Module: wine
Branch: master
Commit: 6fd90f16259fd91743ca6bb7869c5e2d15a43f45
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6fd90f16259fd91743ca6bb7869c5e2d15a43f45

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Sun Mar 30 21:18:49 2008 -0700

quartz: Small mpeg splitter fixes.

Just to be cautious, since it reads 4 bytes it should stop trying at
EOF-3. Also be more strict with the return values.

---

 dlls/quartz/mpegsplit.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c
index dca0042..0ecafc8 100644
--- a/dlls/quartz/mpegsplit.c
+++ b/dlls/quartz/mpegsplit.c
@@ -651,16 +651,18 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin)
                 This->EndOfFile -= 128;
 
             /* http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm has a whole readup on audio headers */
-            while (pos < This->EndOfFile && SUCCEEDED(hr))
+            while (pos + 3 < This->EndOfFile)
             {
                 LONGLONG length = 0;
                 hr = IAsyncReader_SyncRead(pPin->pReader, pos, 4, header);
+                if (hr != S_OK)
+                    break;
                 while (parse_header(header, &length, &duration))
                 {
                     /* No valid header yet; shift by a byte and check again */
                     memmove(header, header+1, 3);
                     hr = IAsyncReader_SyncRead(pPin->pReader, pos++, 1, header + 3);
-                    if (FAILED(hr))
+                    if (hr != S_OK || This->EndOfFile - pos < 4)
                        break;
                 }
                 pos += length;




More information about the wine-cvs mailing list