summaryrefslogtreecommitdiff
path: root/libqpdf/BitStream.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/BitStream.cc')
-rw-r--r--libqpdf/BitStream.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/libqpdf/BitStream.cc b/libqpdf/BitStream.cc
index eb511f7..14eae55 100644
--- a/libqpdf/BitStream.cc
+++ b/libqpdf/BitStream.cc
@@ -16,6 +16,10 @@ BitStream::reset()
{
p = start;
bit_offset = 7;
+ if (static_cast<unsigned int>(nbytes) > static_cast<unsigned int>(-1) / 8)
+ {
+ throw std::runtime_error("array too large for bitstream");
+ }
bits_available = 8 * nbytes;
}