Crash in ReadChunk()
-
Hi there,
Using cineware SDK v22.008 (VS2013 libs), I'm getting a crash when trying to process the file attached. The crash stack is:
FwdFX_d.fx!cineware::PrivateChunk::ReadChunk(class cineware::HyperFile *,bool,bool) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadObject(class cineware::HyperFile *,bool) Unknown FwdFX_d.fx!cineware::MoGraphFractureVoronoiObject::Read(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::BaseObject::HandleSubChunk(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadChunk(class cineware::HyperFile *,bool,bool) Unknown FwdFX_d.fx!cineware::RootObject::HandleSubChunk(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadChunk(class cineware::HyperFile *,bool,bool) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadObject(class cineware::HyperFile *,bool) Unknown FwdFX_d.fx!cineware::BaseObject::HandleSubChunk(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadChunk(class cineware::HyperFile *,bool,bool) Unknown FwdFX_d.fx!cineware::RootObject::HandleSubChunk(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadChunk(class cineware::HyperFile *,bool,bool) Unknown FwdFX_d.fx!cineware::RootList2D::HandleSubChunk(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::RootObject::HandleSubChunk(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadChunk(class cineware::HyperFile *,bool,bool) Unknown FwdFX_d.fx!cineware::BaseDocument::HandleSubChunk(class cineware::HyperFile *,int,int) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadChunk(class cineware::HyperFile *,bool,bool) Unknown FwdFX_d.fx!cineware::PrivateChunk::ReadObject(class cineware::HyperFile *,bool) Unknown
and the log contains:
First-chance exception at 0x000000001F5BDA64 (FwdFX_d.fx) in FX_d.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Any clues as to what is going wrong here and how I can fix it?
The file is here: model loop 7.c4d
Regards,
Tom -
Hello @thomasmfields,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.
About your First Question
Thanks a lot for reaching out. To support you, please provide a code snippet that we can reproduce the issue.
What do you want to achieve?Thanks and Cheers
Jana -
Hi Jana,
I'd like it not to crash, please. My code looks like this:
fn.SetMemoryReadMode(data, size); // The contents of the file are in "data". cineware::AlienBaseDocument *c4dDoc = NewObj(cineware::AlienBaseDocument); cineware::HyperFile *c4dFile = NewObj(cineware::HyperFile); if (c4dDoc && c4dFile) { if (c4dFile->Open(DOC_IDENT, fn, cineware::FILEOPEN_READ)) { if (c4dDoc->ReadObject(c4dFile, true)) { } } }
Are you able to reproduce the issue?
Regards,
Tom -
Hi Tom,
can you please try the following:
- does it work if you load the same data from disk
- can you try with LoadDocument(fn, SCENEFILTER::SCENEFILTER_OBJECTS | SCENEFILTER::SCENEFILTER_MATERIALS)
And how did you load the file into memory?
Cheers
Jens -
Hi Jens,
I get the same error stack when I do the following:
cineware::Filename myFile("model loop 7.c4d");
cineware::BaseDocument *baseDoc = LoadDocument(myFile, cineware::SCENEFILTER::SCENEFILTER_OBJECTS | cineware::SCENEFILTER::SCENEFILTER_MATERIALS);I load the file into memory using my own file stream API, which is used successfully elsewhere and with other c4d files. I'm using ReadFile() and GetFileSizeEx()
Regards,
Tom -
Hi Tom,
I could confirm the issue!
You can fix this in "c4d_fracturevoronoidata.h" line 52 like this:
RootObject* _head = nullptr;
Please let me know if this works for you.
Cheers
Jens -
Hi Jens,
That fix works for us. This is excellent. Thank you very much.
Regards,
Tom