Extraction of multibyte payload values using the 0x80 cont bit per byte was incorrectly handling the cont bit when extracting the value bits.
Masking added to processing of 32bit and 64 bit payloads. --- decoder/source/etmv4/trc_pkt_proc_etmv4i_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/decoder/source/etmv4/trc_pkt_proc_etmv4i_impl.cpp b/decoder/source/etmv4/trc_pkt_proc_etmv4i_impl.cpp index 0125788..d7f0fbf 100644 --- a/decoder/source/etmv4/trc_pkt_proc_etmv4i_impl.cpp +++ b/decoder/source/etmv4/trc_pkt_proc_etmv4i_impl.cpp @@ -1462,7 +1462,7 @@ void EtmV4IPktProcImpl::BuildIPacketTable() // each byte has seven bits + cont bit byteVal = buffer[(st_idx + idx)]; lastByte = (byteVal & 0x80) != 0x80; - value |= ((uint32_t)byteVal) << (idx * 7); + value |= ((uint32_t)(byteVal & 0x7F)) << (idx * 7); idx++; } else @@ -1479,14 +1479,14 @@ unsigned EtmV4IPktProcImpl::extractContField64(const std::vector<uint8_t> &buffe bool lastByte = false; uint8_t byteVal; value = 0; - while(!lastByte && (idx < byte_limit)) // max 9 bytes for 32 bit value; + while(!lastByte && (idx < byte_limit)) // max 9 bytes for 64 bit value; { if(buffer.size() > (st_idx + idx)) { // each byte has seven bits + cont bit byteVal = buffer[(st_idx + idx)]; lastByte = (byteVal & 0x80) != 0x80; - value |= ((uint64_t)byteVal) << (idx * 7); + value |= ((uint64_t)(byteVal & 0x7F)) << (idx * 7); idx++; } else