bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.78k stars 480 forks source link

Underflow in size() if stacktrace is smaller than skip_n_firsts() #178

Closed tomdov closed 4 years ago

tomdov commented 4 years ago

this will cause super-mega long loop (from ~max size_t till 0)

bombela commented 4 years ago

https://en.cppreference.com/w/c/types/size_t

size_it is unsigned. It is not possible to return negative numbers.

tomdov commented 4 years ago

correct, the returned number just will be huge and not correct

bombela commented 4 years ago

Then is it correct indeed. If it is huge. Its is a correctly huge value. What's wrong with that?

bombela commented 4 years ago

I just realized what you meant: there is an underflow on the substraction if the stacktrace is smaller than skip_n_firsts().