From d6b01a557a272509499f2edf16b1ae556a9663a1 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 15 Oct 2021 18:39:07 +0200 Subject: [PATCH] Fix out-of-bound with short layers names in GdsDriver::GdsStream. * Bug: In CRL::GdsDriver::GdsStream::operator<<(Cell*), when looking for layer names ending with ".pin", must also check that the string is at least 4 characters long. --- crlcore/src/ccore/gds/GdsDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crlcore/src/ccore/gds/GdsDriver.cpp b/crlcore/src/ccore/gds/GdsDriver.cpp index cb4dbea0..7c7434a3 100644 --- a/crlcore/src/ccore/gds/GdsDriver.cpp +++ b/crlcore/src/ccore/gds/GdsDriver.cpp @@ -821,7 +821,7 @@ namespace { const BasicLayer* exportLayer = layer; if (NetExternalComponents::isExternal(component)) { string layerName = getString( layer->getName() ); - if (layerName.substr(layerName.size()-4) != ".pin") { + if ((layerName.size() > 4) and (layerName.substr(layerName.size()-4) != ".pin")) { exportLayer = tech->getBasicLayer( layerName+".pin" ); if (not exportLayer) exportLayer = layer; }