Skip to content

Commit

Permalink
size() may return negative number
Browse files Browse the repository at this point in the history
this will cause super-mega long loop (from ~max size_t till 0)
  • Loading branch information
tomdov committed Jul 21, 2020
1 parent 29e4061 commit 10c8df5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class StackTraceImplBase {
class StackTraceImplHolder : public StackTraceImplBase {
public:
size_t size() const {
return _stacktrace.size() ? _stacktrace.size() - skip_n_firsts() : 0;
return (_stacktrace.size() >= skip_n_firsts()) ? _stacktrace.size() - skip_n_firsts() : 0;
}
Trace operator[](size_t idx) const {
if (idx >= size()) {
Expand Down

0 comments on commit 10c8df5

Please sign in to comment.