|
KiCad PCB EDA Suite
|
#include <boost/test/unit_test.hpp>#include <cstring>#include <wx/filename.h>#include <wx/wfstream.h>#include <http_lib/http_lib_connection.h>#include <libraries/library_manager.h>#include <libraries/symbol_library_adapter.h>#include <lib_symbol.h>#include <sch_io/http_lib/sch_io_http_lib.h>#include <ki_exception.h>Go to the source code of this file.
Functions | |
| static wxFileName | writeUnreachableHttpLib () |
| Issue #24477. | |
| BOOST_AUTO_TEST_CASE (SubLibraryQueriesSurviveNetworkLoss) | |
| The sub-library queries used while building the library tree must not crash when the HTTP endpoint is unreachable. | |
| BOOST_AUTO_TEST_CASE (ConnectionReportsInvalidEndpointOnNetworkLoss) | |
| The connection object itself must report an invalid endpoint (and not crash) when it cannot reach the server. | |
| BOOST_AUTO_TEST_CASE | ( | ConnectionReportsInvalidEndpointOnNetworkLoss | ) |
The connection object itself must report an invalid endpoint (and not crash) when it cannot reach the server.
Definition at line 121 of file test_issue24477_http_network_loss.cpp.
References HTTP_LIB_SOURCE::api_version, HTTP_LIB_CONNECTION::GetLastError(), HTTP_LIB_CONNECTION::IsValidEndpoint(), HTTP_LIB_SOURCE::root_url, and HTTP_LIB_SOURCE::token.
| BOOST_AUTO_TEST_CASE | ( | SubLibraryQueriesSurviveNetworkLoss | ) |
The sub-library queries used while building the library tree must not crash when the HTTP endpoint is unreachable.
Before the fix these dereferenced a null connection.
Definition at line 87 of file test_issue24477_http_network_loss.cpp.
References SCH_IO_HTTP_LIB::EnumerateSymbolLib(), SCH_IO_HTTP_LIB::GetSubLibraryDescription(), SCH_IO_HTTP_LIB::GetSubLibraryNames(), SCH_IO_HTTP_LIB::SetLibraryManagerAdapter(), and writeUnreachableHttpLib().
|
static |
Issue #24477.
KiCad crashed when network connectivity was lost while using an HTTP library.
Opening a schematic that references an HTTP symbol library while the network is unreachable previously crashed. SCH_IO_HTTP_LIB::GetSubLibraryNames() and GetSubLibraryDescription() dereferenced the connection pointer (m_conn) without first establishing or null-checking it. When the connection could not be created the pointer was null and the access faulted (SIGSEGV) while the library tree was built.
The query entry points now degrade to an empty result instead of crashing, so the schematic still opens. Write a .kicad_httplib config pointing at an unreachable endpoint.
Port 1 is reserved and refuses connections immediately on localhost, so the curl connect attempt fails fast rather than waiting on the connect timeout. This emulates "no network connectivity" without an actual network round-trip.
Definition at line 57 of file test_issue24477_http_network_loss.cpp.
References BOOST_REQUIRE(), and writeUnreachableHttpLib().
Referenced by BOOST_AUTO_TEST_CASE(), and writeUnreachableHttpLib().