arthurscchan commented on code in PR #13826:
URL: https://github.com/apache/trafficserver/pull/13826#discussion_r4280539400


##########
tests/fuzzing/fuzz_header_conversion.cc:
##########
@@ -0,0 +1,152 @@
+#include "proxy/hdrs/HTTP.h"
+#include "proxy/hdrs/HeaderValidator.h"
+#include "proxy/hdrs/VersionConverter.h"
+#include "tscore/Diags.h"
+#include "tsutil/PostScript.h"
+
+#include <fuzzer/FuzzedDataProvider.h>
+
+#include <array>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <string_view>
+#include <vector>
+
+extern int cmd_disable_pfreelist;
+
+namespace
+{
+constexpr size_t MAX_INPUT_LENGTH = 64 * 1024;
+constexpr std::array<std::string_view, 17> FIELD_NAMES = {
+  ":method",    ":scheme",    ":authority",       ":path",             
":status", "host",
+  "cookie",     "connection", "keep-alive",       "proxy-connection",  
"upgrade", "transfer-encoding",
+  "te",         "content-length", "content-type", "x-test",            "",
+};
+
+void
+add_field(HTTPHdr &header, std::string_view name, std::string_view value)
+{
+  MIMEField *field = header.field_create(name);
+
+  field->value_set(header.m_heap, header.m_mime, value);
+  header.field_attach(field);
+}

Review Comment:
   It is confirmed that the HeaderValidator will not return nullptr, it 
literally put empty string into a newly allocated logic. Thus this comment is 
not correct.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to