<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I just rediscovered a sword bug that I told you about over a year
ago. For Bibletime it crashes the program when you try to use the
Personal Commentary in write mode on Windows. <br>
<br>
I upgraded to Sword 1.62 recently and this caused the bug to occur
again. I had been using a patched version of 1.6.0 for our Windows
build. Please incorporate the patch this time.<br>
<br>
Thanks,<br>
<br>
Gary Holmlund<br>
<br>
--------------------------------------------------------------------------------<br>
<b>Gary Holmlund</b> <a
href="mailto:sword-devel%40crosswire.org?Subject=Re:%20Re%3A%20%5Bsword-devel%5D%20Patch%20for%20Sword%20crash%20with%20BibleTime%20on%20Windows&In-Reply-To=%3C4AF0ECE1.6090906%40gmail.com%3E"
title="[sword-devel] Patch for Sword crash with BibleTime on
Windows">gary.holmlund at gmail.com </a><br>
<i>Tue Nov 3 19:54:25 MST 2009</i>
<ul>
<li>Previous message: <a
href="http://www.crosswire.org/pipermail/sword-devel/2009-November/033042.html">[sword-devel]
Python client
</a></li>
<li>Next message: <a
href="http://www.crosswire.org/pipermail/sword-devel/2009-November/033044.html">[sword-devel]
Python client
</a></li>
<li> <b>Messages sorted by:</b> <a
href="http://www.crosswire.org/pipermail/sword-devel/2009-November/date.html#33043">[
date ]</a> <a
href="http://www.crosswire.org/pipermail/sword-devel/2009-November/thread.html#33043">[
thread ]</a> <a
href="http://www.crosswire.org/pipermail/sword-devel/2009-November/subject.html#33043">[
subject ]</a> <a
href="http://www.crosswire.org/pipermail/sword-devel/2009-November/author.html#33043">[
author ]</a> </li>
</ul>
<hr>
<pre>Hi,
I am working on BibleTime for Windows and we found and fixed a crash in
the sword library. I have attached a patch for the HEAD of sword svn. We
are using the 1.60 version of sword.
The crash occurs when trying to save to a personal commentary for the
first time. Sword is looking for the "incfile" of the personal
commentary. The file does not exist yet.. Here is the call stack and
function at the crash point.
libsword.dll!<a class="moz-txt-link-freetext" href="sword::FileDesc::read(void">sword::FileDesc::read(void</a> * buf=0x013eaec0, long count=4)
Line 139
libsword.dll!<a class="moz-txt-link-freetext" href="sword::RawFiles::getNextFilename()">sword::RawFiles::getNextFilename()</a> Line 194
libsword.dll!<a class="moz-txt-link-freetext" href="sword::RawFiles::setEntry(const">sword::RawFiles::setEntry(const</a> char * inbuf=0x0253d050,
long len=3) Line 130
bibletime.exe!CSwordModuleInfo::write(CSwordKey * key=0x02e6cd00, const
QString & newText={...}) Line 705
long FileDesc::read(void *buf, long count) {
return ::read(getFd(), buf, count); // crash here
}
Since the file does not exist, getFd() returns a fd of -1. The read
promptly crashes with the negative fd. Tracing the same problem in linux
shows the same -1 fd, but the read does not crash there. The crash seems
specific to the Visual Studio 2008 runtime libraries, but reading with a
negative fd value is clearly wrong.
The fix is simple. Test for the negative fd and return 0 from
fileDesc::read if fd is negative. Returning 0 is what is happening on linux.
Gary Holmlund
</pre>
<br>
</body>
</html>