[xiph-commits] r15133 - in trunk/oggdsf/src/lib: codecs/cmml/dsfCMMLRawSource codecs/flac/filters/dsfNativeFLACSource core/directshow/dsfOggDemux2 core/directshow/dsfOggMux
cristianadam at svn.xiph.org
cristianadam at svn.xiph.org
Thu Jul 24 12:26:11 PDT 2008
Author: cristianadam
Date: 2008-07-24 12:26:11 -0700 (Thu, 24 Jul 2008)
New Revision: 15133
Modified:
trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.cpp
Log:
Fixed Ticket #1392 (OggDemuxPacketSourceFilter GetCurFile memory allocation causes crashes)
Modified: trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp 2008-07-24 19:20:23 UTC (rev 15132)
+++ trunk/oggdsf/src/lib/codecs/cmml/dsfCMMLRawSource/CMMLRawSourceFilter.cpp 2008-07-24 19:26:11 UTC (rev 15133)
@@ -79,9 +79,17 @@
STDMETHODIMP CMMLRawSourceFilter::GetCurFile(LPOLESTR* outFileName, AM_MEDIA_TYPE* outMediaType) {
//Return the filename and mediatype of the raw data
-
- LPOLESTR x = SysAllocString(mFileName.c_str());
- *outFileName = x;
+ CheckPointer(outFileName, E_POINTER);
+ *outFileName = NULL;
+
+ if (!mFileName.empty()) {
+ unsigned int size = sizeof(WCHAR) * (mFileName.size() + 1);
+
+ *outFileName = (LPOLESTR) CoTaskMemAlloc(size);
+ if (*outFileName != NULL) {
+ CopyMemory(*outFileName, mFileName.c_str(), size);
+ }
+ }
return S_OK;
}
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp 2008-07-24 19:20:23 UTC (rev 15132)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp 2008-07-24 19:26:11 UTC (rev 15133)
@@ -104,8 +104,18 @@
//IFileSource Interface
STDMETHODIMP NativeFLACSourceFilter::GetCurFile(LPOLESTR* outFileName, AM_MEDIA_TYPE* outMediaType)
{
- LPOLESTR x = SysAllocString(mFileName.c_str());
- *outFileName = x;
+ CheckPointer(outFileName, E_POINTER);
+ *outFileName = NULL;
+
+ if (!mFileName.empty()) {
+ unsigned int size = sizeof(WCHAR) * (mFileName.size() + 1);
+
+ *outFileName = (LPOLESTR) CoTaskMemAlloc(size);
+ if (*outFileName != NULL) {
+ CopyMemory(*outFileName, mFileName.c_str(), size);
+ }
+ }
+
return S_OK;
}
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp 2008-07-24 19:20:23 UTC (rev 15132)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp 2008-07-24 19:26:11 UTC (rev 15133)
@@ -449,11 +449,17 @@
//IFileSource Interface
STDMETHODIMP OggDemuxPacketSourceFilter::GetCurFile(LPOLESTR* outFileName, AM_MEDIA_TYPE* outMediaType)
{
- ////Return the filename and mediatype of the raw data
- LPOLESTR x = SysAllocString(mFileName.c_str());
- *outFileName = x;
+ CheckPointer(outFileName, E_POINTER);
+ *outFileName = NULL;
- //TODO:::
+ if (!mFileName.empty()) {
+ unsigned int size = sizeof(WCHAR) * (mFileName.size() + 1);
+
+ *outFileName = (LPOLESTR) CoTaskMemAlloc(size);
+ if (*outFileName != NULL) {
+ CopyMemory(*outFileName, mFileName.c_str(), size);
+ }
+ }
return S_OK;
}
Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.cpp 2008-07-24 19:20:23 UTC (rev 15132)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggMux/OggMuxFilter.cpp 2008-07-24 19:26:11 UTC (rev 15133)
@@ -231,9 +231,17 @@
HRESULT OggMuxFilter::GetCurFile(LPOLESTR* outFileName, AM_MEDIA_TYPE* outMediaType) {
//Return the filename and mediatype of the raw data
-
- LPOLESTR x = SysAllocString(mFileName.c_str());
- *outFileName = x;
+ CheckPointer(outFileName, E_POINTER);
+ *outFileName = NULL;
+
+ if (!mFileName.empty()) {
+ unsigned int size = sizeof(WCHAR) * (mFileName.size() + 1);
+
+ *outFileName = (LPOLESTR) CoTaskMemAlloc(size);
+ if (*outFileName != NULL) {
+ CopyMemory(*outFileName, mFileName.c_str(), size);
+ }
+ }
return S_OK;
}
More information about the commits
mailing list