Implement MString(void*) - declared but never defined
Invisible until this session's ServerCore tls/master merge brought Subscription/SubscriptionManager (which calls it) into the same dependency chain as a real executable for the first time - a static library archive (ar) never checks for unresolved symbols, only the final link of a real binary does, so this went unnoticed for however long it sat declared-only in MString.h. Stores the raw pointer value as the string bytes (pointer-identity comparison, matching how void* aliases are compared everywhere else in this codebase) rather than dereferencing it, since some callers pass arbitrary non-string pointers through this constructor.
This commit is contained in:
1 parent
29db853706
commit
a0cef8077d
1 file changed
+18
+18
@@ -27,6 +27,24 @@ namespace coreutils {
|
|||||||
memcpy(this->data, data, length);
|
memcpy(this->data, data, length);
|
||||||
cursor = this->data;
|
cursor = this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Declared alongside MString(const char *data) but never implemented -
|
||||||
|
// invisible until a real executable actually needed this symbol
|
||||||
|
// resolved (a static library archive never checks for unresolved
|
||||||
|
// references, only the final link of a real binary does). Stores the
|
||||||
|
// raw pointer VALUE itself (not a dereference of it) as the string's
|
||||||
|
// bytes, matching how void* aliases are compared everywhere else in
|
||||||
|
// this codebase - by pointer identity, not by string content (e.g.
|
||||||
|
// TCPServer::getSessionByAlias() and TCPSession::compareAlias() both
|
||||||
|
// compare void* aliases directly) - so two MStrings built from the
|
||||||
|
// same alias value compare equal, and one built from an arbitrary
|
||||||
|
// (possibly non-string, possibly not even null-terminated) alias
|
||||||
|
// pointer never risks reading past it.
|
||||||
|
MString::MString(void *alias) {
|
||||||
|
setSize(sizeof(void *));
|
||||||
|
memcpy(this->data, &alias, sizeof(void *));
|
||||||
|
cursor = this->data;
|
||||||
|
}
|
||||||
|
|
||||||
MString::MString(char *data, size_t length) {
|
MString::MString(char *data, size_t length) {
|
||||||
setSize(length);
|
setSize(length);
|
||||||
|
|||||||
Reference in new issue
Block a user