Strange string addition crash
-
Im having a strange problem while trying to run our plugin on R21.207
For some reason adding two string together crashesCrashes:
String totalPath = ppath + ver;
Doesnt Crash
String totalPath = ppath; totalPath.Append(ver);
debug output:
../../../frameworks/cinema_emulation.framework/source/maxon/stringencoding_c4demulation.h(33): CRITICAL: Stop A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Cinema 4D.exe. Exception thrown at 0x00007FFA047D6820 (c4dplugin.xdl64) in Cinema 4D.exe: 0xC0000005: Access violation reading location 0x00000035456D34A0.
-
Hello @ECHekman,
Thank you for reaching out to us. This is rather tricky to answer with the given information. Let's split this into a 'what you should do' and a 'speculation' part.
You marked this topic as R21and we only provide reduced legacy support for it. See Support Procedures - Scope of Support: Version Scope for details. We always try to find a solution where possible, but this might be a case where we can only provide very limited support.
What you should do
- Try to reproduce this in more recent versions of Cinema 4D, ideally 2024/2025.
- Submit crashes to our bug tracker, as you (a) will see there the stack trace resolved, i.e., you get more than the offsets in 'Exception thrown at 0x00007FFA047D6820 (c4dplugin.xdl64) in Cinema 4D.exe: 0xC0000005' and (b) we can then also more easily look into the source. For very old versions such as R21 this could be tricky though, as I do not know if our bug tracker still resolves these stack traces.
- When the two prior points fail, we will need the exact version of Cinema 4D you are using (open the 'About' dialog and copy the version with a right-click).
- Check if this happens for adding for all string data, i.e., adding
"foo"_s + "bar"_s
. Which would strike me as quite unlikely that there is such a fundamental bug in the string template (but also not out of question since the Maxon API just had be introduced with R21). When it is not general, try to hunt down what is special about your data.
Speculation
There is quite little to go on here, except that an access violation happens, which of course implies that either
ppath
orver
is dangling garbage when you try to add them. So, I would try to do the most basic access possible right before adding them, e.g., just print both strings to the (debug) console, to see if they are at least generally accessible at that point or if you are already operating on broken data there.Looking at a recent day
stringencoding_c4demulation.h(33)
which is very likely not the same as the R21 file (did not check though), this region deals with string encodings, particularly variable bit-width encoding. This could have something to do with encoding non-English or otherwise special character strings or that you are trying to add strings with different encodings (heavily speculative).Cheers,
Ferdinand -
Thanks for your response. We found the issue. Turns out we had to delay load our dlls for earlier versions of the plugin R21 etc