mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-30 03:34:25 +03:00
Introduce copy_bytes for writing into bytecode
Protects memcpy from nullptr sources, which triggers failures in GCC's UB sanitizer.
This commit is contained in:
committed by
Matthew Barr
parent
cf3ddd9e88
commit
2a2576e907
@@ -98,8 +98,7 @@ void fillNfa(NFA *nfa, lbr_common *c, ReportID report, const depth &repeatMin,
|
||||
info->packedCtrlSize = rsi.packedCtrlSize;
|
||||
info->horizon = rsi.horizon;
|
||||
info->minPeriod = minPeriod;
|
||||
memcpy(&info->packedFieldSizes, rsi.packedFieldSizes.data(),
|
||||
byte_length(rsi.packedFieldSizes));
|
||||
copy_bytes(&info->packedFieldSizes, rsi.packedFieldSizes);
|
||||
info->patchCount = rsi.patchCount;
|
||||
info->patchSize = rsi.patchSize;
|
||||
info->encodingSize = rsi.encodingSize;
|
||||
@@ -122,7 +121,7 @@ void fillNfa(NFA *nfa, lbr_common *c, ReportID report, const depth &repeatMin,
|
||||
nfa->length = verify_u32(len);
|
||||
info->length = verify_u32(sizeof(RepeatInfo)
|
||||
+ sizeof(u64a) * (rsi.patchSize + 1));
|
||||
memcpy(table, rsi.table.data(), byte_length(rsi.table));
|
||||
copy_bytes(table, rsi.table);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user