system encoding is not protected from freeing during encode/decode operations
Closed / Duplicate2570123b6384460203e0456861e04454296acc78Created 1 year agoUpdated 1 year ago
Descriptionmarkdown2025-08-13 17:11:30
Inspecting code, I have doubts about potential crashes from accessing freed encodings in multithreaded environments. Several functions have code similar to below:
if (encoding == NULL) // encoding is passed by caller
encoding = systemEncoding; // systemEncoding is GLOBAL shared by threads
Do some operations involving the encoding.
The issue I am wondering about is that the reference count on systemEncoding is not incremented in such cases. What happens if some other thread calls encoding system and changes the systemEncoding causing the original one in use above to be freed?
Need to build a test case to verify above race condition but perhaps someone could corroborate or refute my analysis. And save me the trouble of creating the test case :-)
sebreswiki2025-08-13 17:59:20
Is not that a duplicate of [f2ff05fc84]?
apnadkarniplain2025-08-14 11:40:50
Oh, yes it is! Short term memory loss (to go with long term memory loss). Closing as duplicate.
Log in (anonymous is fine) to add a comment.