From 2825b3f502d4ae3be76027d033aa18d57cd28bb1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Nov 2003 11:42:23 +0000 Subject: [PATCH] fix for infinite loop in wxFileConfig when reading from input stream fails (patch 837134) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fileconf.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 6423bbe8e9..1c0337284e 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -494,10 +494,21 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv) wxString strTmp; char buf[1024]; - while ( !inStream.Read(buf, WXSIZEOF(buf)).Eof() ) + for ( ;; ) + { + inStream.Read(buf, WXSIZEOF(buf)); + + if ( !inStream.IsOk() ) + { + wxLogError(_("Error reading config options.")); + break; + } + strTmp.append(wxConvertMB2WX(buf), inStream.LastRead()); - strTmp.append(wxConvertMB2WX(buf), inStream.LastRead()); + if ( inStream.Eof() ) + break; + } strTrans = wxTextBuffer::Translate(strTmp); } -- 2.45.2