BIND 10 trac1245, updated. 3eb0dedb8a5d9835b394484c6112a4b2fcbe9d51 [1245] add NULL checks in PyXXX_ToXXX() functions

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Sep 20 14:35:03 UTC 2011


The branch, trac1245 has been updated
       via  3eb0dedb8a5d9835b394484c6112a4b2fcbe9d51 (commit)
      from  2f8c4b3da6060a9b57e944726dd61cb1b2a19906 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3eb0dedb8a5d9835b394484c6112a4b2fcbe9d51
Author: Jelte Jansen <jelte at isc.org>
Date:   Tue Sep 20 16:34:44 2011 +0200

    [1245] add NULL checks in PyXXX_ToXXX() functions

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/python/edns_python.cc            |    4 ++++
 src/lib/dns/python/messagerenderer_python.cc |    4 ++++
 src/lib/dns/python/name_python.cc            |    4 ++++
 src/lib/dns/python/opcode_python.cc          |    4 ++++
 src/lib/dns/python/question_python.cc        |    4 ++++
 src/lib/dns/python/rcode_python.cc           |    4 ++++
 src/lib/dns/python/rdata_python.cc           |    4 ++++
 src/lib/dns/python/rrclass_python.cc         |    4 ++++
 src/lib/dns/python/rrset_python.cc           |    4 ++++
 src/lib/dns/python/rrttl_python.cc           |    4 ++++
 src/lib/dns/python/rrtype_python.cc          |    4 ++++
 src/lib/dns/python/tsig_python.cc            |    4 ++++
 src/lib/dns/python/tsig_rdata_python.cc      |    4 ++++
 src/lib/dns/python/tsigkey_python.cc         |    4 ++++
 src/lib/dns/python/tsigrecord_python.cc      |    4 ++++
 15 files changed, 60 insertions(+), 0 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/python/edns_python.cc b/src/lib/dns/python/edns_python.cc
index 1264223..8f0f1a4 100644
--- a/src/lib/dns/python/edns_python.cc
+++ b/src/lib/dns/python/edns_python.cc
@@ -380,6 +380,10 @@ PyEDNS_Check(PyObject* obj) {
 
 const EDNS&
 PyEDNS_ToEDNS(const PyObject* edns_obj) {
+    if (edns_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in EDNS PyObject conversion");
+    }
     const s_EDNS* edns = static_cast<const s_EDNS*>(edns_obj);
     return (*edns->cppobj);
 }
diff --git a/src/lib/dns/python/messagerenderer_python.cc b/src/lib/dns/python/messagerenderer_python.cc
index 84993e4..bb89622 100644
--- a/src/lib/dns/python/messagerenderer_python.cc
+++ b/src/lib/dns/python/messagerenderer_python.cc
@@ -253,6 +253,10 @@ PyMessageRenderer_Check(PyObject* obj) {
 
 MessageRenderer&
 PyMessageRenderer_ToMessageRenderer(PyObject* messagerenderer_obj) {
+    if (messagerenderer_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in MessageRenderer PyObject conversion");
+    }
     s_MessageRenderer* messagerenderer = static_cast<s_MessageRenderer*>(messagerenderer_obj);
     return (*messagerenderer->cppobj);
 }
diff --git a/src/lib/dns/python/name_python.cc b/src/lib/dns/python/name_python.cc
index c7dcab3..4043445 100644
--- a/src/lib/dns/python/name_python.cc
+++ b/src/lib/dns/python/name_python.cc
@@ -654,6 +654,10 @@ PyName_Check(PyObject* obj) {
 
 const Name&
 PyName_ToName(const PyObject* name_obj) {
+    if (name_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in Name PyObject conversion");
+    }
     const s_Name* name = static_cast<const s_Name*>(name_obj);
     return (*name->cppobj);
 }
diff --git a/src/lib/dns/python/opcode_python.cc b/src/lib/dns/python/opcode_python.cc
index 4917dc2..50436a9 100644
--- a/src/lib/dns/python/opcode_python.cc
+++ b/src/lib/dns/python/opcode_python.cc
@@ -358,6 +358,10 @@ PyOpcode_Check(PyObject* obj) {
 
 const Opcode&
 PyOpcode_ToOpcode(const PyObject* opcode_obj) {
+    if (opcode_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in Opcode PyObject conversion");
+    }
     const s_Opcode* opcode = static_cast<const s_Opcode*>(opcode_obj);
     return (*opcode->cppobj);
 }
diff --git a/src/lib/dns/python/question_python.cc b/src/lib/dns/python/question_python.cc
index 76c95f0..44d68a2 100644
--- a/src/lib/dns/python/question_python.cc
+++ b/src/lib/dns/python/question_python.cc
@@ -308,6 +308,10 @@ PyQuestion_Check(PyObject* obj) {
 
 const Question&
 PyQuestion_ToQuestion(const PyObject* question_obj) {
+    if (question_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in Question PyObject conversion");
+    }
     const s_Question* question = static_cast<const s_Question*>(question_obj);
     return (*question->cppobj);
 }
diff --git a/src/lib/dns/python/rcode_python.cc b/src/lib/dns/python/rcode_python.cc
index eb5bbed..42b48e7 100644
--- a/src/lib/dns/python/rcode_python.cc
+++ b/src/lib/dns/python/rcode_python.cc
@@ -398,6 +398,10 @@ PyRcode_Check(PyObject* obj) {
 
 const Rcode&
 PyRcode_ToRcode(const PyObject* rcode_obj) {
+    if (rcode_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in Rcode PyObject conversion");
+    }
     const s_Rcode* rcode = static_cast<const s_Rcode*>(rcode_obj);
     return (*rcode->cppobj);
 }
diff --git a/src/lib/dns/python/rdata_python.cc b/src/lib/dns/python/rdata_python.cc
index 9a8caf5..06c0263 100644
--- a/src/lib/dns/python/rdata_python.cc
+++ b/src/lib/dns/python/rdata_python.cc
@@ -285,6 +285,10 @@ PyRdata_Check(PyObject* obj) {
 
 const Rdata&
 PyRdata_ToRdata(const PyObject* rdata_obj) {
+    if (rdata_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in Rdata PyObject conversion");
+    }
     const s_Rdata* rdata = static_cast<const s_Rdata*>(rdata_obj);
     return (*rdata->cppobj);
 }
diff --git a/src/lib/dns/python/rrclass_python.cc b/src/lib/dns/python/rrclass_python.cc
index abdcc84..0014187 100644
--- a/src/lib/dns/python/rrclass_python.cc
+++ b/src/lib/dns/python/rrclass_python.cc
@@ -353,6 +353,10 @@ PyRRClass_Check(PyObject* obj) {
 
 const RRClass&
 PyRRClass_ToRRClass(const PyObject* rrclass_obj) {
+    if (rrclass_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in RRClass PyObject conversion");
+    }
     const s_RRClass* rrclass = static_cast<const s_RRClass*>(rrclass_obj);
     return (*rrclass->cppobj);
 }
diff --git a/src/lib/dns/python/rrset_python.cc b/src/lib/dns/python/rrset_python.cc
index 27ded07..9fc3d79 100644
--- a/src/lib/dns/python/rrset_python.cc
+++ b/src/lib/dns/python/rrset_python.cc
@@ -448,6 +448,10 @@ PyRRset_ToRRset(PyObject* rrset_obj) {
 
 RRsetPtr
 PyRRset_ToRRsetPtr(PyObject* rrset_obj) {
+    if (rrset_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in RRset PyObject conversion");
+    }
     s_RRset* rrset = static_cast<s_RRset*>(rrset_obj);
     return (rrset->cppobj);
 }
diff --git a/src/lib/dns/python/rrttl_python.cc b/src/lib/dns/python/rrttl_python.cc
index 99a6f85..3a3f067 100644
--- a/src/lib/dns/python/rrttl_python.cc
+++ b/src/lib/dns/python/rrttl_python.cc
@@ -308,6 +308,10 @@ PyRRTTL_Check(PyObject* obj) {
 
 const RRTTL&
 PyRRTTL_ToRRTTL(const PyObject* rrttl_obj) {
+    if (rrttl_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in RRTTL PyObject conversion");
+    }
     const s_RRTTL* rrttl = static_cast<const s_RRTTL*>(rrttl_obj);
     return (*rrttl->cppobj);
 }
diff --git a/src/lib/dns/python/rrtype_python.cc b/src/lib/dns/python/rrtype_python.cc
index 0cd88fb..bf20b7c 100644
--- a/src/lib/dns/python/rrtype_python.cc
+++ b/src/lib/dns/python/rrtype_python.cc
@@ -450,6 +450,10 @@ PyRRType_Check(PyObject* obj) {
 
 const RRType&
 PyRRType_ToRRType(const PyObject* rrtype_obj) {
+    if (rrtype_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in RRType PyObject conversion");
+    }
     const s_RRType* rrtype = static_cast<const s_RRType*>(rrtype_obj);
     return (*rrtype->cppobj);
 }
diff --git a/src/lib/dns/python/tsig_python.cc b/src/lib/dns/python/tsig_python.cc
index b836c23..0764e33 100644
--- a/src/lib/dns/python/tsig_python.cc
+++ b/src/lib/dns/python/tsig_python.cc
@@ -312,6 +312,10 @@ PyTSIGContext_Check(PyObject* obj) {
 
 TSIGContext&
 PyTSIGContext_ToTSIGContext(PyObject* tsigcontext_obj) {
+    if (tsigcontext_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in TSIGContext PyObject conversion");
+    }
     s_TSIGContext* tsigcontext = static_cast<s_TSIGContext*>(tsigcontext_obj);
     return (*tsigcontext->cppobj);
 }
diff --git a/src/lib/dns/python/tsig_rdata_python.cc b/src/lib/dns/python/tsig_rdata_python.cc
index c22bf0d..6ec0f09 100644
--- a/src/lib/dns/python/tsig_rdata_python.cc
+++ b/src/lib/dns/python/tsig_rdata_python.cc
@@ -354,6 +354,10 @@ PyTSIG_Check(PyObject* obj) {
 
 const any::TSIG&
 PyTSIG_ToTSIG(const PyObject* tsig_obj) {
+    if (tsig_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in TSIG PyObject conversion");
+    }
     const s_TSIG* tsig = static_cast<const s_TSIG*>(tsig_obj);
     return (*tsig->cppobj);
 }
diff --git a/src/lib/dns/python/tsigkey_python.cc b/src/lib/dns/python/tsigkey_python.cc
index ff13a12..cf79c1a 100644
--- a/src/lib/dns/python/tsigkey_python.cc
+++ b/src/lib/dns/python/tsigkey_python.cc
@@ -454,6 +454,10 @@ PyTSIGKeyRing_Check(PyObject* obj) {
 
 const TSIGKeyRing&
 PyTSIGKeyRing_ToTSIGKeyRing(const PyObject* tsigkeyring_obj) {
+    if (tsigkeyring_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in TSIGKeyRing PyObject conversion");
+    }
     const s_TSIGKeyRing* tsigkeyring =
         static_cast<const s_TSIGKeyRing*>(tsigkeyring_obj);
     return (*tsigkeyring->cppobj);
diff --git a/src/lib/dns/python/tsigrecord_python.cc b/src/lib/dns/python/tsigrecord_python.cc
index d75ced3..c754dd2 100644
--- a/src/lib/dns/python/tsigrecord_python.cc
+++ b/src/lib/dns/python/tsigrecord_python.cc
@@ -279,6 +279,10 @@ PyTSIGRecord_Check(PyObject* obj) {
 
 const TSIGRecord&
 PyTSIGRecord_ToTSIGRecord(PyObject* tsigrecord_obj) {
+    if (tsigrecord_obj == NULL) {
+        isc_throw(PyCPPWrapperException,
+                  "obj argument NULL in TSIGRecord PyObject conversion");
+    }
     s_TSIGRecord* tsigrecord = static_cast<s_TSIGRecord*>(tsigrecord_obj);
     return (*tsigrecord->cppobj);
 }




More information about the bind10-changes mailing list