From 7f82bcd5af8f7d230a175adaef606a8191c81833 Mon Sep 17 00:00:00 2001 From: sahvx655-wq Date: Mon, 8 Jun 2026 20:48:45 +0530 Subject: [PATCH] bound exp-golomb suffix read to bitstream in avc_nalu_read_uev --- src/brpc/details/rtmp_utils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/brpc/details/rtmp_utils.cpp b/src/brpc/details/rtmp_utils.cpp index ea37636882..396dd945bd 100644 --- a/src/brpc/details/rtmp_utils.cpp +++ b/src/brpc/details/rtmp_utils.cpp @@ -42,6 +42,9 @@ int avc_nalu_read_uev(BitStream* stream, int32_t* v) { } int32_t result = (1 << leadingZeroBits) - 1; for (int i = 0; i < leadingZeroBits; i++) { + if (stream->empty()) { + return -1; + } int32_t b = stream->read_bit(); result += b << (leadingZeroBits - 1); }