Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest fuzzer for zbar_image_set_data() and zbar_image_convert(). #233

Open
autofuzzoss opened this issue Oct 11, 2022 · 0 comments
Open

Comments

@autofuzzoss
Copy link

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 <gtest/gtest.h>
#include <stdio.h>
#include <stdlib.h>

#include <zbar.h>
#include "FuzzedDataProvider.h"

using namespace zbar;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, uint32_t size) {
  FuzzedDataProvider provider(data, size);
  auto autofuzz0 = provider.ConsumeRemainingBytesAsString();

  zbar_image_t *img = zbar_image_create();
  if(!img)
    return 0;
  zbar_image_set_size(img, 8, 8);
  zbar_image_set_format(img, zbar_fourcc('J', 'P', 'E', 'G'));
  zbar_image_set_data(img, autofuzz0.c_str(), autofuzz0.size(), NULL);
  zbar_image_t *test = zbar_image_convert(img, zbar_fourcc('Y', '8', '0', '0'));
  if(!test)
    return 0;
  free(img);
  free(test);
  return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant