From 719bed0ae21071963ab6e8cc09c51e88212cbcb0 Mon Sep 17 00:00:00 2001 From: Snappy Team Date: Sat, 14 Nov 2020 21:55:24 +0000 Subject: Bug fix. Error on 0 offset copies. PiperOrigin-RevId: 342447553 --- snappy.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snappy.cc b/snappy.cc index 7c75d21..e972c18 100644 --- a/snappy.cc +++ b/snappy.cc @@ -892,6 +892,8 @@ std::pair DecompressBranchless( // always succeed for literals. if (SNAPPY_PREDICT_FALSE(offset < len)) { assert(tag_type != 0); + // offset 0 is an error. + if (SNAPPY_PREDICT_FALSE(offset == 0)) break; op = IncrementalCopy(op_base + delta, op_base + op, op_base + op + len, op_base + op_limit) - op_base; -- cgit v1.2.1