]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: protect the {ACCOUNTING,AWS_AUTHv4,RESTFUL}_IO casts with assert.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 11 Oct 2016 15:34:05 +0000 (17:34 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Fri, 21 Oct 2016 20:57:22 +0000 (22:57 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_client_io.h

index 5db0a9f45bfb0936fbfc9dcac4a099af99974ca6..82460d0d1021be416e23811a35e67976897915e9 100644 (file)
@@ -213,14 +213,21 @@ public:
 /* Type conversions to work around lack of req_state type hierarchy matching
  * (e.g.) REST backends (may be replaced w/dynamic typed req_state). */
 static inline rgw::io::RestfulClient* RESTFUL_IO(struct req_state* s) {
+  assert(dynamic_cast<rgw::io::RestfulClient*>(s->cio) != nullptr);
+
   return static_cast<rgw::io::RestfulClient*>(s->cio);
 }
 
 static inline rgw::io::Accounter* ACCOUNTING_IO(struct req_state* s) {
-  return dynamic_cast<rgw::io::Accounter*>(s->cio);
+  auto ptr = dynamic_cast<rgw::io::Accounter*>(s->cio);
+  assert(ptr != nullptr);
+
+  return ptr;
 }
 
 static inline RGWRestfulIO* AWS_AUTHv4_IO(struct req_state* s) {
+  assert(dynamic_cast<RGWRestfulIO*>(s->cio) != nullptr);
+
   return static_cast<RGWRestfulIO*>(s->cio);
 }