mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-17 09:45:28 +03:00
rose/hwlm: limit literals to eight bytes
Rework HWLM to work over literals of eight bytes ("medium length"),
doing confirm in the Rose interpreter.
This commit is contained in:
committed by
Matthew Barr
parent
5c9c540424
commit
07a6b6510c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Intel Corporation
|
||||
* Copyright (c) 2016-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -502,6 +502,7 @@ void RoseInstrCheckLongLit::write(void *dest, RoseEngineBlob &blob,
|
||||
assert(!literal.empty());
|
||||
inst->lit_offset = blob.add(literal.c_str(), literal.size(), 1);
|
||||
inst->lit_length = verify_u32(literal.size());
|
||||
inst->fail_jump = calc_jump(offset_map, this, target);
|
||||
}
|
||||
|
||||
void RoseInstrCheckLongLitNocase::write(void *dest, RoseEngineBlob &blob,
|
||||
@@ -511,6 +512,27 @@ void RoseInstrCheckLongLitNocase::write(void *dest, RoseEngineBlob &blob,
|
||||
assert(!literal.empty());
|
||||
inst->lit_offset = blob.add(literal.c_str(), literal.size(), 1);
|
||||
inst->lit_length = verify_u32(literal.size());
|
||||
inst->fail_jump = calc_jump(offset_map, this, target);
|
||||
}
|
||||
|
||||
void RoseInstrCheckMedLit::write(void *dest, RoseEngineBlob &blob,
|
||||
const OffsetMap &offset_map) const {
|
||||
RoseInstrBase::write(dest, blob, offset_map);
|
||||
auto *inst = static_cast<impl_type *>(dest);
|
||||
assert(!literal.empty());
|
||||
inst->lit_offset = blob.add(literal.c_str(), literal.size(), 1);
|
||||
inst->lit_length = verify_u32(literal.size());
|
||||
inst->fail_jump = calc_jump(offset_map, this, target);
|
||||
}
|
||||
|
||||
void RoseInstrCheckMedLitNocase::write(void *dest, RoseEngineBlob &blob,
|
||||
const OffsetMap &offset_map) const {
|
||||
RoseInstrBase::write(dest, blob, offset_map);
|
||||
auto *inst = static_cast<impl_type *>(dest);
|
||||
assert(!literal.empty());
|
||||
inst->lit_offset = blob.add(literal.c_str(), literal.size(), 1);
|
||||
inst->lit_length = verify_u32(literal.size());
|
||||
inst->fail_jump = calc_jump(offset_map, this, target);
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
Reference in New Issue
Block a user