You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "arthurscchan (via GitHub)" <gi...@apache.org> on 2026/09/28 04:11:16 UTC

[PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

arthurscchan opened a new pull request, #13738:
URL: https://github.com/apache/trafficserver/pull/13738

   This PR creates a new OSS-Fuzz fuzzer targets chunk processing with some additional coppora for the new fuzzer.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "arthurscchan (via GitHub)" <gi...@apache.org>.
arthurscchan commented on PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#issuecomment-6032883088

   Thanks. I have fixed the linting problem.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#issuecomment-6004276155

   [approve ci]


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "arthurscchan (via GitHub)" <gi...@apache.org>.
arthurscchan commented on PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#issuecomment-6011085478

   I have updated the corpora to provide them in zip file. But I cannot fix the format problems since I cannot access the error log for that.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan commented on PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#issuecomment-5863321678

   [approve ci]


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#discussion_r4122658513


##########
tests/fuzzing/fuzz_chunked.cc:
##########
@@ -0,0 +1,97 @@
+/** @file
+
+   fuzzing proxy/http/ChunkedHandler
+
+   @section license License
+
+   Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
+   See the NOTICE file distributed with this work for additional information regarding copyright
+   ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software distributed under the License
+   is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+   or implied. See the License for the specific language governing permissions and limitations under
+   the License.
+*/
+
+#include "proxy/http/HttpTunnel.h"
+#include "proxy/hdrs/HTTP.h"
+
+#include "iocore/eventsystem/IOBuffer.h"
+#include "records/RecordsConfig.h"
+#include "tscore/Layout.h"
+
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+
+#define kMinInputLength 2
+#define kMaxInputLength (64 * 1024)
+#define TEST_THREADS 1
+
+extern int cmd_disable_pfreelist;
+
+namespace
+{
+bool
+DoInitialization()
+{
+  Layout::create();
+  RecProcessInit();
+  LibRecordsConfigInit();
+
+  ink_event_system_init(EVENT_SYSTEM_MODULE_PUBLIC_VERSION);
+  eventProcessor.start(TEST_THREADS);
+  static EThread *main_thread = new EThread;
+  main_thread->set_specific();
+  http_init();
+
+  return true;
+}
+
+void
+fuzz_chunked_content(const uint8_t *data, size_t size, size_t fragment_size, bool strict)
+{
+  MIOBuffer      *buffer = new_MIOBuffer(BUFFER_SIZE_INDEX_4K);
+  IOBufferReader *reader = buffer->alloc_reader();
+
+  ChunkedHandler handler;
+  handler.init_by_action(reader, ChunkedHandler::Action::DECHUNK, false, strict);
+  handler.dechunked_reader = handler.dechunked_buffer->alloc_reader();
+  handler.state            = ChunkedHandler::ChunkedState::READ_SIZE;
+
+  for (size_t offset = 0; offset < size;) {
+    size_t length = std::min(fragment_size, size - offset);
+    buffer->write(data + offset, length);
+    offset += length;
+
+    if (handler.process_chunked_content().second) {
+      break;
+    }
+  }
+
+  handler.clear();
+  free_MIOBuffer(buffer);
+}
+} // namespace
+
+extern "C" int
+LLVMFuzzerTestOneInput(const uint8_t *input_data, size_t size_data)
+{
+  if (size_data < kMinInputLength || size_data > kMaxInputLength) {
+    return 0;
+  }
+
+  cmd_disable_pfreelist = true;
+  [[maybe_unused]] static bool initialized = DoInitialization();
+
+  size_t fragment_size = static_cast<size_t>(1) << (input_data[0] & 7);
+  fuzz_chunked_content(input_data + 1, size_data - 1, fragment_size, true);

Review Comment:
   Every added seed is LF-delimited, so this strict invocation rejects each one at the first size-line terminator and never seeds strict parsing of chunk bodies, extensions, or trailers. Keep the intentionally ambiguous LF case, but provide CRLF-delimited normal seeds for the multiple-chunk and extension/trailer paths.



##########
tests/fuzzing/corpus/chunked/extensions-and-trailers:
##########
@@ -0,0 +1,6 @@
+3a;name=value;quoted="a\\\"b"

Review Comment:
   The harness consumes the first byte as the fragmentation selector, so this seed is actually parsed as an `a` (10-byte) chunk, while the following body contains 58 bytes. The leftover digits are then interpreted as another chunk-size line, and the advertised zero chunk and trailers are never reached. Keep the selector `3`, but add the intended `3a` size after it.



-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan commented on PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#issuecomment-5874680436

   [approve ci]


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan commented on PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#issuecomment-5863332687

   oss-fuzz is allowed again by infrastructure last week. I will have to update to that first before trying this out. 


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan commented on PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738#issuecomment-6023786517

   > I have updated the corpora to provide them in zip file. But I cannot fix the format problems since I cannot access the error log for that.
   
   Let me show it here. 
   ```
   --- a/tests/fuzzing/fuzz_chunked.cc
   +++ b/tests/fuzzing/fuzz_chunked.cc
   @@ -31,7 +31,7 @@
    
    #define kMinInputLength 2
    #define kMaxInputLength (64 * 1024)
   -#define TEST_THREADS 1
   +#define TEST_THREADS    1
    
    extern int cmd_disable_pfreelist;
    
   @@ -86,7 +86,7 @@ LLVMFuzzerTestOneInput(const uint8_t *input_data, size_t size_data)
        return 0;
      }
    
   -  cmd_disable_pfreelist = true;
   +  cmd_disable_pfreelist                    = true;
      [[maybe_unused]] static bool initialized = DoInitialization();
    
      size_t fragment_size = static_cast<size_t>(1) << (input_data[0] & 7);
   
   ```


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OSS-Fuzz: Add new fuzzer targets chunk processing [trafficserver]

Posted by "shukitchan (via GitHub)" <gi...@apache.org>.
shukitchan merged PR #13738:
URL: https://github.com/apache/trafficserver/pull/13738


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org