Blame src/fuzz/clariswksfuzzer.cpp

rpm-build 6f7582
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
rpm-build 6f7582
rpm-build 6f7582
/* libmwaw
rpm-build 6f7582
* Version: MPL 2.0 / LGPLv2+
rpm-build 6f7582
*
rpm-build 6f7582
* The contents of this file are subject to the Mozilla Public License Version
rpm-build 6f7582
* 2.0 (the "License"); you may not use this file except in compliance with
rpm-build 6f7582
* the License or as specified alternatively below. You may obtain a copy of
rpm-build 6f7582
* the License at http://www.mozilla.org/MPL/
rpm-build 6f7582
*
rpm-build 6f7582
* Software distributed under the License is distributed on an "AS IS" basis,
rpm-build 6f7582
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
rpm-build 6f7582
* for the specific language governing rights and limitations under the
rpm-build 6f7582
* License.
rpm-build 6f7582
*
rpm-build 6f7582
* Major Contributor(s):
rpm-build 6f7582
* Copyright (C) 2017 David Tardon (dtardon@redhat.com)
rpm-build 6f7582
*
rpm-build 6f7582
*
rpm-build 6f7582
* All Rights Reserved.
rpm-build 6f7582
*
rpm-build 6f7582
* For minor contributions see the git repository.
rpm-build 6f7582
*
rpm-build 6f7582
* Alternatively, the contents of this file may be used under the terms of
rpm-build 6f7582
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
rpm-build 6f7582
* in which case the provisions of the LGPLv2+ are applicable
rpm-build 6f7582
* instead of those above.
rpm-build 6f7582
*/
rpm-build 6f7582
rpm-build 6f7582
#include <cstdint>
rpm-build 6f7582
#include <cstdlib>
rpm-build 6f7582
rpm-build 6f7582
#include <libmwaw/libmwaw.hxx>
rpm-build 6f7582
rpm-build 6f7582
#include <librevenge-generators/RVNGDummyDrawingGenerator.h>
rpm-build 6f7582
#include <librevenge-generators/RVNGDummyPresentationGenerator.h>
rpm-build 6f7582
#include <librevenge-generators/RVNGDummySpreadsheetGenerator.h>
rpm-build 6f7582
#include <librevenge-generators/RVNGDummyTextGenerator.h>
rpm-build 6f7582
rpm-build 6f7582
#include <librevenge-stream/librevenge-stream.h>
rpm-build 6f7582
rpm-build 6f7582
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
rpm-build 6f7582
{
rpm-build 6f7582
  librevenge::RVNGStringStream input(data, size);
rpm-build 6f7582
  MWAWDocument::Type type = MWAWDocument::MWAW_T_UNKNOWN;
rpm-build 6f7582
  MWAWDocument::Kind kind = MWAWDocument::MWAW_K_UNKNOWN;
rpm-build 6f7582
  MWAWDocument::isFileFormatSupported(&input, type, kind);
rpm-build 6f7582
  switch (kind) {
rpm-build 6f7582
  case MWAWDocument::MWAW_K_TEXT : {
rpm-build 6f7582
    librevenge::RVNGDummyTextGenerator generator;
rpm-build 6f7582
    MWAWDocument::parse(&input, &generator);
rpm-build 6f7582
    break;
rpm-build 6f7582
  }
rpm-build 6f7582
  case MWAWDocument::MWAW_K_DRAW :
rpm-build 6f7582
  case MWAWDocument::MWAW_K_PAINT : {
rpm-build 6f7582
    librevenge::RVNGDummyDrawingGenerator generator;
rpm-build 6f7582
    MWAWDocument::parse(&input, &generator);
rpm-build 6f7582
    break;
rpm-build 6f7582
  }
rpm-build 6f7582
  case MWAWDocument::MWAW_K_PRESENTATION : {
rpm-build 6f7582
    librevenge::RVNGDummyPresentationGenerator generator;
rpm-build 6f7582
    MWAWDocument::parse(&input, &generator);
rpm-build 6f7582
    break;
rpm-build 6f7582
  }
rpm-build 6f7582
  case MWAWDocument::MWAW_K_DATABASE :
rpm-build 6f7582
  case MWAWDocument::MWAW_K_SPREADSHEET : {
rpm-build 6f7582
    librevenge::RVNGDummySpreadsheetGenerator generator;
rpm-build 6f7582
    MWAWDocument::parse(&input, &generator);
rpm-build 6f7582
    break;
rpm-build 6f7582
  }
rpm-build 6f7582
  default :
rpm-build 6f7582
    break;
rpm-build 6f7582
  }
rpm-build 6f7582
  return 0;
rpm-build 6f7582
}
rpm-build 6f7582
rpm-build 6f7582
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: