From: Samuel Just Date: Mon, 4 May 2020 18:44:07 +0000 (-0700) Subject: include/denc.h: throw exception if insufficient buffer during header decode X-Git-Tag: v16.1.0~2330^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=562f90304ad41d1f68f4ae782a254ec09311b3dd;p=ceph.git include/denc.h: throw exception if insufficient buffer during header decode Signed-off-by: Samuel Just --- diff --git a/src/include/denc.h b/src/include/denc.h index a7dd3cca4ff2b..6cc53277b9450 100644 --- a/src/include/denc.h +++ b/src/include/denc.h @@ -38,7 +38,6 @@ #include #include -#include "include/ceph_assert.h" // boost clobbers this #include "include/intarith.h" #include "include/int_types.h" #include "include/scope_guard.h" @@ -1736,7 +1735,9 @@ inline std::enable_if_t decode_nohead( uint32_t *struct_len) { \ const char *pos = p.get_pos(); \ char *end = *start_pos + *struct_len; \ - ceph_assert(pos <= end); \ + if (pos > end) { \ + throw ::ceph::buffer::malformed_input(__PRETTY_FUNCTION__); \ + } \ if (pos < end) { \ p += end - pos; \ } \