X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4db97e24f5e2ad38970c55148ddb807399ecd191..880da677a495220275f81e0738a23da4e977e312:/samples/docview/doc.cpp?ds=inline diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp index 24f3984b16..e093d82ae3 100644 --- a/samples/docview/doc.cpp +++ b/samples/docview/doc.cpp @@ -79,6 +79,16 @@ DocumentIstream& DrawingDocument::LoadObject(DocumentIstream& istream) wxInt32 count = 0; stream >> count; + if ( count < 0 ) + { + wxLogWarning("Drawing document corrupted: invalid segments count."); +#if wxUSE_STD_IOSTREAM + istream.clear(std::ios::badbit); +#else + istream.Reset(wxSTREAM_READ_ERROR); +#endif + return istream; + } for ( int n = 0; n < count; n++ ) {