Kelson has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/78379 )
Change subject: Fixed a bug in two funnctions which caused zimdump to cause a segmentation fault when the url passed was not found in the zim file. The error occurred when the tool attempts to display the article. ...................................................................... Fixed a bug in two funnctions which caused zimdump to cause a segmentation fault when the url passed was not found in the zim file. The error occurred when the tool attempts to display the article. Change-Id: Ica90f36dc7b8aef93de9581355030b6f08a2ca61 --- M zimlib/src/tools/zimDump.cpp 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/zimlib/src/tools/zimDump.cpp b/zimlib/src/tools/zimDump.cpp index e7f6b3a..65d13b8 100644 --- a/zimlib/src/tools/zimDump.cpp +++ b/zimlib/src/tools/zimDump.cpp @@ -46,7 +46,7 @@ { } void setVerbose(bool sw = true) { verbose = sw; } - + void printInfo(); void printNsInfo(char ch); void locateArticle(zim::size_type idx); @@ -84,11 +84,11 @@ "cluster count: " << file.getFileheader().getClusterCount() << "\n" "cluster ptr pos: " << file.getFileheader().getClusterPtrPos() << "\n"; if (file.getFileheader().hasChecksum()) - std::cout << + std::cout << "checksum pos: " << file.getFileheader().getChecksumPos() << "\n" "checksum: " << file.getChecksum() << "\n"; else - std::cout << + std::cout << "no checksum\n"; if (file.getFileheader().hasMainPage()) @@ -135,13 +135,19 @@ void ZimDumper::printPage() { log_trace("print page"); - std::cout << pos->getPage() << std::flush; + if(pos!=file.end()) + { + std::cout << pos->getPage() << std::flush; + } } void ZimDumper::dumpArticle() { log_trace("dump article"); - std::cout << pos->getData() << std::flush; + if(pos!=file.end()) + { + std::cout << pos->getData() << std::flush; + } } void ZimDumper::dumpIndex() -- To view, visit https://gerrit.wikimedia.org/r/78379 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ica90f36dc7b8aef93de9581355030b6f08a2ca61 Gerrit-PatchSet: 1 Gerrit-Project: openzim Gerrit-Branch: master Gerrit-Owner: Kiran mathew koshy 1993 <kiranmathewko...@gmail.com> Gerrit-Reviewer: Kelson <kel...@kiwix.org> Gerrit-Reviewer: Tntnet <to...@tntnet.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits