Skip to content

Commit e638d4c

Browse files
authored
Update libfsst12.cpp
fix buffer overruns (detected on windows)
1 parent e512ced commit e638d4c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎libfsst12.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static inline ulong compressBulk(SymbolMap &symbolMap, ulong nlines, const ulong
239239
}
240240
cur += (code >> 12);
241241
res |= (code&FSST_CODE_MASK) << 12;
242-
memcpy(out, &res, sizeof(u64));
242+
memcpy(out, &res, sizeof(u32));
243243
out += 3;
244244
}
245245
while (cur < end) {
@@ -250,14 +250,14 @@ static inline ulong compressBulk(SymbolMap &symbolMap, ulong nlines, const ulong
250250
}
251251
cur += code >> 12;
252252
if (cur >= end) {
253-
memcpy(out, &res, sizeof(u64));
254-
out += 2;
253+
memcpy(out, &res, sizeof(u32));
254+
out += 2;
255255
break;
256256
}
257257
code = symbolMap.findExpansion(Symbol(cur, end));
258258
res |= (code&FSST_CODE_MASK) << 12;
259259
cur += code >> 12;
260-
memcpy(out, &res, sizeof(u64));
260+
memcpy(out, &res, sizeof(u32));
261261
out += 3;
262262
}
263263
lenOut[curLine] = out - strOut[curLine];

0 commit comments

Comments
 (0)