diff --git a/plugins/3d/oce/loadmodel.cpp b/plugins/3d/oce/loadmodel.cpp index c08f756193..f295726c39 100644 --- a/plugins/3d/oce/loadmodel.cpp +++ b/plugins/3d/oce/loadmodel.cpp @@ -481,7 +481,17 @@ bool readSTEPZ( Handle(TDocStd_Document)& m_doc, const char* aFileName ) char *buffer = new char[size]; ifile.Read( buffer, size); - std::string expanded = gzip::decompress( buffer, size ); + std::string expanded; + + try + { + expanded = gzip::decompress( buffer, size ); + } + catch(...) + { + delete[] buffer; + return false; + } delete[] buffer; diff --git a/plugins/3d/vrml/vrml.cpp b/plugins/3d/vrml/vrml.cpp index d339a1539a..6929ed8524 100644 --- a/plugins/3d/vrml/vrml.cpp +++ b/plugins/3d/vrml/vrml.cpp @@ -187,7 +187,17 @@ SCENEGRAPH* LoadVRML( const wxString& aFileName, bool useInline ) char *buffer = new char[size]; ifile.Read( buffer, size); - std::string expanded = gzip::decompress( buffer, size ); + std::string expanded; + + try + { + expanded = gzip::decompress( buffer, size ); + } + catch(...) + { + delete[] buffer; + return nullptr; + } delete[] buffer; diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index 380858a522..3537a61b30 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -995,7 +995,17 @@ bool PCBMODEL::getModelLabel( const std::string aFileName, TRIPLET aScale, TDF_L char *buffer = new char[size]; ifile.Read( buffer, size); - std::string expanded = gzip::decompress( buffer, size ); + std::string expanded; + + try + { + expanded = gzip::decompress( buffer, size ); + } + catch(...) + { + delete[] buffer; + return false; + } delete[] buffer;