Skip to content

ai.cpp中访问数组下标-1导致崩溃 #1

Description

@cyanlink

ai.cpp中,GetFinalRes函数判断NextNodeList[0] == -1 是否成立,而后将这个可能为-1的数作为了返回值的数组下标,造成运行时断言失败。此BUG为间歇性出现。
python main.py
生成了572个节点,用时0.0048
生成了1520个节点,用时0.0116
生成了1413个节点,用时0.0099
生成了6781个节点,用时0.0405
生成了1776个节点,用时0.0106
生成了26600个节点,用时0.1736
NextNodeList[0] = -1.
/usr/include/c++/9/bits/stl_vector.h:1042: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = Node; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::reference = Node&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
[1] 36775 abort python main.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions