Skip to content
Snippets Groups Projects
Commit a1cb7f9e authored by hofmockel's avatar hofmockel
Browse files

Raise error if offset+size is too big

parent 3afcb986
No related branches found
No related tags found
No related merge requests found
......@@ -464,6 +464,10 @@ cdef Slice slice_transform_callback(void* ctx, const Slice& src) with gil:
ret = (<object>ctx).transform(slice_to_bytes(src))
offset = ret[0]
size = ret[1]
if (offset + size) > src.size():
msg = "offset(%i) + size(%i) is bigger than slice(%i)"
raise Exception(msg % (offset, size, src.size()))
return Slice(src.data() + offset, size)
except Exception as error:
print error
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment