[Live-devel] Problem! If Matroska file not exist

Ross Finlayson finlayson at live555.com
Mon Aug 27 01:06:24 PDT 2012


> If Matroska if is not exist the program will crash.
> 
> 1. In MatroskaFile.cpp 
> 
> fParserForInitialization
> 		= new MatroskaFileParser(*this, ByteStreamFileSource::createNew(envir(), fileName),
> 		handleEndOfTrackHeaderParsing, this, NULL);   
[...]
> // if Matroska file is not exist, the fParserForInitialization is a invalid pointer.

No, that should not be the case.  If the file "fileName" does not exist, then the call to "ByteStreamFileSource::createNew(envir(), fileName)" will return NULL, and therefore the "MatroskaFileParser" constructor will be called with an "inputSource" parameter of NULL.  This will cause the "fInputSource" member variable to get set to NULL.  That should be OK, because we always check that "fInputSource" is NULL before we try to dereference it.  But in any case, a valid "MatroskaFileParser" object should be constructed, and thus "fParserForInitialization" should be valid (and non-NULL).

I won't rule out the possibility of there being some problem with the code if the file "fileName" does not exist, but if there is, then it's not what you described.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120827/dfdb49c3/attachment.html>


More information about the live-devel mailing list