Skip to content

Conversation

miss-programgamer
Copy link

Removed the arbitrary and unnecessarily restrictive limitation of in-memory IOStream instances being disallowed from having a length of 0. This is particularly problematic for the cases of creating a stream from a zero-length string & of creating an in-memory cache of an empty file. I looked at the internals and the implementation already prevents any access to the memory pointer if the length is zero, and even the pointer math being performed on the internal cursors work out to a correct result when the memory pointer is NULL. I even built and tested my own SDL3.dll with this change and everything worked fine.

In particular, the checks at the top of SDL_IOFromMem and SDL_IOFromConstMem have been changed to only emit an error in the case of the length being >0 and also the memory pointer being NULL, otherwise allowing the stream to be created as normal.

@slouken slouken added this to the 3.4.0 milestone Aug 31, 2025
@slouken
Copy link
Collaborator

slouken commented Sep 13, 2025

The unit tests might need to be updated to accommodate this change:

22:  08/31/25 18:44:46: Harness input to repro failures:
22:  08/31/25 18:44:46:  --seed IMIQGRMISN68DXB1 --filter iostrm_testParamNegative

@miss-programgamer
Copy link
Author

Oh word, I'll fix it and push the test changes as well then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants