fix dereferencing out-of-range iterator (caught by -fsanitize=undefined,integer) (#3867)
This commit is contained in:
parent
5b8b75e680
commit
eb1a32eb79
2 changed files with 10 additions and 6 deletions
|
@ -81,18 +81,21 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
position_--;
|
||||
--position_;
|
||||
mapnik::fill(*position_, 0); // fill with transparent colour
|
||||
}
|
||||
return *position_;
|
||||
}
|
||||
bool in_range() const
|
||||
{
|
||||
return (position_ != buffers_.end());
|
||||
}
|
||||
|
||||
void pop()
|
||||
{
|
||||
if (position_ != buffers_.end())
|
||||
{
|
||||
position_++;
|
||||
}
|
||||
// ^ ensure irator is not out-of-range
|
||||
// prior calling this method
|
||||
++position_;
|
||||
}
|
||||
|
||||
T & top() const
|
||||
|
|
|
@ -340,7 +340,8 @@ void agg_renderer<T0,T1>::end_style_processing(feature_type_style const& st)
|
|||
-common_.t_.offset(),
|
||||
-common_.t_.offset());
|
||||
}
|
||||
if (¤t_buffer == &internal_buffers_.top())
|
||||
if (internal_buffers_.in_range()
|
||||
&& ¤t_buffer == &internal_buffers_.top())
|
||||
{
|
||||
internal_buffers_.pop();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue