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 rlottie::Animation::loadFromFile() #532

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

Suggest fuzzer for rlottie::Animation::loadFromFile() #532

autofuzzoss opened this issue Oct 11, 2022 · 0 comments

Comments

@autofuzzoss
Copy link

autofuzzoss commented Oct 11, 2022

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 "rlottie.h"
#include <fstream>

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

  OFS << Content;
  return true;
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, uint32_t size) {
  FuzzedDataProvider provider(data, size);
  std::string InputPath = "input";
  auto input = provider.ConsumeRandomLengthString();
  saveFile(InputPath, input);
  auto out = rlottie::Animation::loadFromFile(InputPath.c_str());
  if (!out)
    return 0;
  out->totalFrame();
  size_t width, height;
  out->size(width, height);

  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