[bind10-dev] core dump in unit tests on Solaris and NetBSD

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Tue Mar 2 01:01:29 UTC 2010


At Mon, 1 Mar 2010 13:07:35 -0600 (CST),
"Jeremy C. Reed" <jreed at isc.org> wrote:

> On Solaris:

Apparently g++ 3.x doesn't set the EOF bit to the istringbuf after
the streambuf version of operator>>.  Try the copied test code on
NetBSD, I guess the result would be
foo bar, EOF: 0

The current implementation expects this would be
foo bar, EOF: 1

that's the reason for the crash (more precisely, exception).

Due to the semantics of this version of operator>>, maybe we can
simply skip the EOF check.

Index: ds_43.cc
===================================================================
--- ds_43.cc	(revision 1067)
+++ ds_43.cc	(working copy)
@@ -57,7 +57,7 @@
     stringbuf digestbuf;
 
     iss >> tag >> algorithm >> digest_type >> &digestbuf;
-    if (iss.bad() || iss.fail() || !iss.eof()) {
+    if (iss.bad() || iss.fail()) {
         dns_throw(InvalidRdataText, "Invalid DS text");
     }
     if (tag > 0xffff) {

---
JINMEI, Tatuya

#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int
main()
{
    istringstream iss("foo bar");
    stringbuf sb;
    iss >> &sb;
    cout << sb.str() << ", EOF: " << iss.eof() << endl;

    return (0);
}



More information about the bind10-dev mailing list