]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Format fuzzing targets
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 16 Aug 2023 14:44:37 +0000 (16:44 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 16 Aug 2023 14:44:37 +0000 (16:44 +0200)
.not-formatted
pdns/dnsdistdist/fuzz_dnsdistcache.cc
pdns/fuzz_moadnsparser.cc
pdns/fuzz_packetcache.cc
pdns/fuzz_proxyprotocol.cc
pdns/fuzz_zoneparsertng.cc

index e48e5f4affe6b0e31e030bc69fc2d9a846a889f2..c4d86e3d296482d1d61fbae0b3b67d7b14f322af 100644 (file)
 ./pdns/ednssubnet.hh
 ./pdns/fstrm_logger.cc
 ./pdns/fstrm_logger.hh
-./pdns/fuzz_dnsdistcache.cc
-./pdns/fuzz_moadnsparser.cc
-./pdns/fuzz_packetcache.cc
-./pdns/fuzz_proxyprotocol.cc
-./pdns/fuzz_zoneparsertng.cc
 ./pdns/gettime.cc
 ./pdns/gettime.hh
 ./pdns/histog.hh
index c224449533e057a36e44f78bb984be77eb35c9fe..6c10920d4a9a697976351db9dd835e86b0e37b87 100644 (file)
@@ -24,7 +24,8 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
 
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
 
   if (size > std::numeric_limits<uint16_t>::max()) {
     return 0;
@@ -44,16 +45,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
     uint16_t qtype;
     uint16_t qclass;
     unsigned int consumed;
-    PacketBuffer vect(data, data+size);
+    PacketBuffer vect(data, data + size);
     const DNSName qname(reinterpret_cast<const char*>(data), size, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
     pcSkipCookies.getKey(qname.getStorage(), consumed, vect, false);
     pcHashCookies.getKey(qname.getStorage(), consumed, vect, false);
     boost::optional<Netmask> subnet;
     DNSDistPacketCache::getClientSubnet(vect, consumed, subnet);
   }
-  catch(const std::exception& e) {
+  catch (const std::exception& e) {
   }
-  catch(const PDNSException& e) {
+  catch (const PDNSException& e) {
   }
 
   return 0;
index 2605ea82047efcb4abf3c630d32fb89080667641..afb3bdea4598a910657fcc0ce23823a126163fe7 100644 (file)
@@ -33,7 +33,8 @@ static void init()
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
 
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
   static bool initialized = false;
 
   if (!initialized) {
@@ -48,17 +49,17 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   try {
     MOADNSParser moaQuery(true, reinterpret_cast<const char*>(data), size);
   }
-  catch(const std::exception& e) {
+  catch (const std::exception& e) {
   }
-  catch(const PDNSException& e) {
+  catch (const PDNSException& e) {
   }
 
   try {
     MOADNSParser moaAnswer(false, reinterpret_cast<const char*>(data), size);
   }
-  catch(const std::exception& e) {
+  catch (const std::exception& e) {
   }
-  catch(const PDNSException& e) {
+  catch (const PDNSException& e) {
   }
 
   return 0;
index 0c982d0e72acf76a72471bc6d7a40ba31fb9bd54..d607586d53b3657b54b780cf333d7308033ce525 100644 (file)
@@ -27,7 +27,8 @@ StatBag S;
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
 
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
 
   if (size > std::numeric_limits<uint16_t>::max() || size < sizeof(dnsheader)) {
     return 0;
@@ -37,28 +38,28 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
 
   /* auth's version */
   try {
-    static const std::unordered_set<uint16_t> optionsToIgnore{ EDNSOptionCode::COOKIE };
+    static const std::unordered_set<uint16_t> optionsToIgnore{EDNSOptionCode::COOKIE};
 
     PacketCache::canHashPacket(input, optionsToIgnore);
     DNSName qname(input.data(), input.size(), sizeof(dnsheader), false);
     PacketCache::queryMatches(input, input, qname, optionsToIgnore);
   }
-  catch(const std::exception& e) {
+  catch (const std::exception& e) {
   }
-  catch(const PDNSException& e) {
+  catch (const PDNSException& e) {
   }
 
   /* recursor's version */
   try {
-    static const std::unordered_set<uint16_t> optionsToIgnore{ EDNSOptionCode::COOKIE, EDNSOptionCode::ECS };
+    static const std::unordered_set<uint16_t> optionsToIgnore{EDNSOptionCode::COOKIE, EDNSOptionCode::ECS};
 
     PacketCache::canHashPacket(input, optionsToIgnore);
     DNSName qname(input.data(), input.size(), sizeof(dnsheader), false);
     PacketCache::queryMatches(input, input, qname, optionsToIgnore);
   }
-  catch(const std::exception& e) {
+  catch (const std::exception& e) {
   }
-  catch(const PDNSException& e) {
+  catch (const PDNSException& e) {
   }
 
   return 0;
index 25885c8883d08952f2233f94b5a7eff5bcb31e4e..f9ec613ef33dafa0501818979927e643e883e944 100644 (file)
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
 
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
 
   std::vector<ProxyProtocolValue> values;
   ComboAddress source;
   ComboAddress destination;
   bool proxy = false;
-  bool tcp = false;  
+  bool tcp = false;
 
   try {
     parseProxyHeader(std::string(reinterpret_cast<const char*>(data), size), proxy, source, destination, tcp, values);
   }
-  catch(const std::exception& e) {
+  catch (const std::exception& e) {
   }
-  catch(const PDNSException& e) {
+  catch (const PDNSException& e) {
   }
 
   return 0;
index 98e0d5ce383c9ae4b6e350a4f4eae987607efb6e..03c4ca55d0929d99f6aa1eb54c211d4ce004557b 100644 (file)
@@ -35,7 +35,8 @@ static void init()
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
 
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
   static bool initialized = false;
 
   if (!initialized) {
@@ -56,9 +57,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
     while (zpt.get(drr)) {
     }
   }
-  catch(const std::exception& e) {
+  catch (const std::exception& e) {
   }
-  catch(const PDNSException& e) {
+  catch (const PDNSException& e) {
   }
 
   return 0;