Skip to content

Commit ddc0fec

Browse files
PatriceBlinclaude
andcommitted
fix(string): restrict encryption to C strings only
Replace isString() with isCString() in both the global-variable and struct-field encoding paths. isString() matches any [N x i8] array, including binary data arrays (bitmasks, protocol constants, numeric byte tables) that happen to have no embedded null bytes. isCString() restricts encryption to proper null-terminated C strings only. This prevents the pass from encrypting arrays like QUIC crypto labels, DTLS bitmask tables, and test data arrays such as {1,1,...,1}, which caused memory corruption and test failures in the OpenSSL QUIC ACK manager test (75-test_quic_ackm.t). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cba95f8 commit ddc0fec

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

string/StringObfuscation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bool StringObfuscatorPass::encodeAllStrings(Module &M) {
109109
// Encode the value and update the variable
110110
if (isa<ConstantDataArray>(initializer)) { // Global variable
111111
auto array = cast<ConstantDataArray>(initializer);
112-
if (array->isString()) {
112+
if (array->isCString()) {
113113
encodeGlobalString(ctx, &gv, array);
114114
}
115115
} else if (isa<ConstantStruct>(initializer)) { // Variable in a struct
@@ -118,7 +118,7 @@ bool StringObfuscatorPass::encodeAllStrings(Module &M) {
118118
auto operand = cs->getOperand(i);
119119
if (isa<ConstantDataArray>(operand)) {
120120
auto array = cast<ConstantDataArray>(operand);
121-
if (array->isString()) {
121+
if (array->isCString()) {
122122
encodeStructString(ctx, &gv, cs, array, i);
123123
}
124124
}

0 commit comments

Comments
 (0)