-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Godot crashes when importing OGG file or renaming folder / OGG Vorbis (release builds only) #87076
Comments
It would have been nice if this issue included an example project or an .ogg file to verify the crash. I can reproduce the crash with this project ogg_error_spam.zip from #84712 on I can't reproduce the crash on latest 3524346 (v4.3.dev) Important to note that the crash seems to only be triggered by corrupt .ogg files and not any .ogg file as the description implies. (Windows 10.0.22621) |
I get an Access Violation in both 4.2.1 and 4.3 Dev 1 when importing the file from that ZIP archive, but only in the release builds, not in my debug build. That may be a bit tricky to debug. Error -135 by the way means that the file contains non-audio data (comments?). I suppose that's an internal detail and not necessarily something that needs to be reported to the user. |
I've also seen this problem manifest when cloning my exsting Godot project. If the |
Will revert when Godot can import a clean workspace without crashing. See godotengine/godot#87076.
I did some assembly-level debugging on the release exe. So far it looks like the crash happens shortly after processing a zero-length packet in the OGG file, even though zero-length packets cause no issues in the debug builds. The actual cause for the crash seems to be trying to decrement the reference count of a zero pointer in a |
Uh, this is kind of wild. First of all: I think the crash could be prevented just by adding an A The crash happens in template <class T>
void CowData<T>::_unref(void *p_data) {
if (!p_data) {
return;
}
SafeNumeric<uint32_t> *refc = _get_refcount();
if (refc->decrement() > 0) {
return; // still in use
}
// clean up
if (!std::is_trivially_destructible<T>::value) {
uint32_t *count = _get_size();
T *data = (T *)(count + 1);
for (uint32_t i = 0; i < *count; ++i) {
// call destructors
data[i].~T();
}
}
// free mem
Memory::free_static((uint8_t *)p_data, true);
} At first glance, it appears a bit suspicious that a null check is done only for the method parameter
Spoiler alert: The C++ compiler does not make that assumption. The crash occurs in an inlined version of the method and the actual code being executed looks more like this: SafeNumeric<uint32_t> *refc = this->_ptr ?
reinterpret_cast<SafeNumeric<uint32_t> *>(_ptr) - 2 :
nullptr;
if (refc->decrement() > 0) {
return; // still in use
}
Memory::free_static((uint8_t *)p_data, true); Note that the check for So is this a bug in the compiler? Isn't this code semantically different from the C++ source, especially, since This might be kind of a big deal, since |
Hello everyone, Sorry, I was busy, so it took a while. What is a corrupt .ogg file? A file that is damaged? I can open and play the file on Windows 10, just as a hint. |
@bs-mwoerner thanks for your deep dive into the code, it was an interesting read. I've built your code in the linked pull request (a production build using mono,
|
Ah! Edit: I wasn't able to reproduce the crash in a |
@RichTeaMan I created a new pull request #87246 that explicitly checks the packet size before calling I'm not 100% sure this fixes your problem, because your backtrace makes it sound as if your segfault happens in libcoreclr.so, but maybe that's just how the exception travels to the handler. It's certainly worth a try.
This might be solved by the fix I am proposing, but so far, I've only worked with OGG files that contain only an audio stream. I can't comment on what exactly happens when there's an OGG Theora video stream as well. In theory, the low-level library should separate the streams so that the importer doesn't see a difference.
In this particular context, the crash is probably triggered by OGG streams that contain zero-length packets. That's not forbidden, so if that's the only issue, then the file is not actually "corrupt" or "damaged", just "unusual". Edit: I had a look at the Loading-Glitch.ogg you provided, @DevMimas, and I can't play that file in VLC or Windows Media Player and |
@bs-mwoerner thanks, the new build seems to import and play ogg files just fine. As an observation, when one specific sound plays a runtime error is logged:
The sound is still played and the game continues, but there's clearly something strange with this one particular file. VLC plays it without complaint. Thank you. |
That's great news, thanks for testing! I get that same message at the end of the Since the importer pre-parses the entire file anyway, it may be cleanest to just drop empty packet from the parsed data. There's a source code comment that says empty pages should still be added to the index, though, so I'll have to think about the implications a bit. |
All right. Thank you very much for your explanation. Yes, the file does not contain an audio line. So now I know that the file contains some kind of error. |
Tested versions
Godot Engine v4.2.1.stable.mono.official
System information
Windows 10 - Godot v4.2.1.stable.mono.official (Forward+)
Issue description
Godot Editor crashes (v4.2.1),
If you remove the OGG file from the project folder, the project is loaded successfully.
Better description needed
I would also like the error text to be better defined. For Lain it is absolutely meaningless.
See also my proposal: godotengine/godot-proposals#8808
My commit in the pull request: #84723
Vide open OGG file project
2024-01-15.23-26-39.mp4
Steps to reproduce
N/A
Minimal reproduction project (MRP)
OGG TestProject.zip
The text was updated successfully, but these errors were encountered: