File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -5651,10 +5651,20 @@ class zip_file
56515651 throw std::runtime_error (" didn't find end of central directory signature" );
56525652 }
56535653
5654+ if (position + 2 >= buffer_.size ())
5655+ {
5656+ throw std::runtime_error (" central dictionary position invalid" );
5657+ }
5658+
56545659 uint16_t length = static_cast <uint16_t >(buffer_[position + 1 ]);
56555660 length = static_cast <uint16_t >(length << 8 ) + static_cast <uint16_t >(buffer_[position]);
56565661 position += 2 ;
56575662
5663+ if (position + length > buffer_.size ())
5664+ {
5665+ throw std::runtime_error (" comment too long" );
5666+ }
5667+
56585668 if (length != 0 )
56595669 {
56605670 comment = std::string (buffer_.data () + position, buffer_.data () + position + length);
You can’t perform that action at this time.
0 commit comments