From 838eadd47f9b413a96b5d05fa2968a4c4ecff214 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 1 Oct 2023 09:56:22 +0200 Subject: [PATCH] Eeschema: fix a crash when loading a schematic if a symbol in a sheet has a lib_name containing {slash} instead of / (related to commits #2f51d22b and b2bf28f5) From master branch. Fixes #15791 https://gitlab.com/kicad/code/kicad/-/issues/15791 --- eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 2803fcaf6e..647db3a532 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -2609,6 +2609,11 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol() } libName = FromUTF8(); + // Some symbol LIB_IDs or lib_name have the '/' character escaped which can break + // symbol links. The '/' character is no longer an illegal LIB_ID character so + // it doesn't need to be escaped. + libName.Replace( "{slash}", "/" ); + NeedRIGHT(); break; } @@ -2626,6 +2631,7 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol() // symbol links. The '/' character is no longer an illegal LIB_ID character so // it doesn't need to be escaped. name.Replace( "{slash}", "/" ); + int bad_pos = libId.Parse( name ); if( bad_pos >= 0 )