Skip to content

Conversation

@LeatherWang
Copy link
Contributor

When extracted line segments number over given size of lines.sId(default: 5 * edges.numOfEdges), it will result in array out of range, which further cause a segment fault as below. This is a small probability event, but it did happen in practical use.

*** Aborted at 1641264940 (unix time) try "date -d @1641264940" if you are using GNU date ***
PC: @                0x0 (unknown)
*** SIGABRT (@0x3e800001cc8) received by PID 7368 (TID 0x7ff538ff8700) from PID 7368; stack trace: ***
    @     0x7ff56ff71390 (unknown)
    @     0x7ff56e57e428 gsignal
    @     0x7ff56e58002a abort
    @     0x7ff56e5c07ea (unknown)
    @     0x7ff56e5c79dc (unknown)
    @     0x7ff56e5c9678 (unknown)
    @     0x7ff56e5cd53c cfree
    @     0x7ff56fb2787d cv::line_descriptor::BinaryDescriptor::EDLineDetector::~EDLineDetector()
    @     0x7ff56fb3386a cv::detail::PtrOwnerImpl<>::deleteSelf()
    @     0x7ff56fb25ffb cv::line_descriptor::BinaryDescriptor::~BinaryDescriptor()
    @     0x7ff56fb26059 cv::line_descriptor::BinaryDescriptor::~BinaryDescriptor()
    @     0x7ff56fb33453 cv::detail::PtrOwnerImpl<>::deleteSelf()

}
// Avoid array out of range
if(numOfLines >= lines.sId.size()) {
lines.sId.emplace_back(offsetInLineArray);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use .push_back as 3.4 branch doesn't have C++11 requirement (should support C++98)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done.

Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@opencv-pushbot opencv-pushbot merged commit b0ab32e into opencv:3.4 Jan 5, 2022
@alalek alalek mentioned this pull request Jan 12, 2022
@alalek alalek mentioned this pull request Jan 28, 2022
@alalek alalek mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants