HdrHistogram / HdrHistogram/HdrHistogram_c

Suggest fuzzer for hdr_log_read()

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
290
Forks
111
Avg merge
1d 16h
Merged PRs (30d)
3

Description

I suggest this fuzzer for continuous vulnerability checks.


/*
 * This fuzzer is generated by UTopia with some manual modifications.
 * (UTopia Project: https://github.com/Samsung/UTopia)
 */

#include "FuzzedDataProvider.h"
#include <fstream>
#include <hdr/hdr_histogram_log.h>
#include <math.h>

bool save_file(std::string Path, std::string Content) {
  std::ofstream OFS(Path);
  if (!OFS.is_open())
    return false;

  OFS << Content;
  return true;
}

void fuzz_hdr_log_read(FuzzedDataProvider &provider) {
  auto input = provider.ConsumeRemainingBytesAsString();
  const char *file_name = "input.log";
  save_file(file_name, input);

  struct hdr_histogram *h = NULL;
  hdr_timespec timestamp, interval;

  FILE *f = fopen(file_name, "r");
  if (NULL == f) {
    fprintf(stderr, "Open file: [%d] %s", errno, strerror(errno));
    return;
  }

  hdr_log_read(NULL, f, &h, &timestamp, &interval);
  fclose(f);
  remove(file_name);
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, uint32_t size) {
  FuzzedDataProvider provider(data, size);
  fuzz_hdr_log_read(provider);
  
  return 0;
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the hdr_log_read() entry point and review how this C library builds and tests code. Determine where the provided C++ harness should be integrated, then verify that continuous fuzzing exercises hdr_log_read() with arbitrary log input and completes without leaving temporary files.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
security, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.