Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Android/art/art/tools/fuzzer/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 2 kB image not shown  

Quelle  libart_fast_compiler_fuzzer.cc

  Sprache: C
 

/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed 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 <cstdint>
#include <vector>

#include "dex/standard_dex_file.h"
#include "driver/compiler_options.h"
#include "fuzzer_common.h"
#include "gc/heap.h"
#include "runtime.h"

namespace art {
namespace fuzzer {

// Global variable to count how many DEX files passed DEX file verification and they were
// registered, since these are the cases for which we would be running the GC. In case of
// scheduling multiple fuzzer jobs, using the ‘-jobs’ flag, this is not shared among the threads.
int skipped_gc_iterations = 0;
// Global variable to call the GC once every maximum number of iterations.
// TODO: These values were obtained from local experimenting. They can be changed after
// further investigation.
static constexpr int kMaxSkipGCIterations = 3000;

// Extra debugging information.
static constexpr bool kDebugPrints = false;

std::vector<std::unique_ptr<uint8_t[]>> data_to_delete;
std::vector<std::unique_ptr<StandardDexFile>> dex_files_to_delete;

std::unique_ptr<CompilerOptions> compiler_options;
std::unique_ptr<FuzzerCompilerCallbacks> callbacks;
// No need for unique_ptr as it is just a fake storage.
FuzzerCompiledMethodStorage storage;

extern "C" int LLVMFuzzerInitialize([[maybe_unused]] int* argc, [[maybe_unused]] char*** argv) {
  callbacks.reset(new FuzzerCompilerCallbacks());
  FuzzerInitialize(callbacks.get(), InstructionSet::kArm64);
  compiler_options = CreateCompilerOptions(/*is_baseline=*/false, InstructionSet::kArm64);

  // Extra checks so that the fast fuzzer does something
  CHECK(compiler_options->GetImplicitNullChecks());
  CHECK(compiler_options->GetImplicitStackOverflowChecks());
  CHECK(!compiler_options->GetDebuggable());
  CHECK(!art::kUseTableLookupReadBarrier);
  CHECK(art::kReserveMarkingRegister);
  CHECK(!art::kPoisonHeapReferences);
  return 0;
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  return FastCompilerFuzzerTestOneInput(data,
                                        size,
                                        compiler_options.get(),
                                        callbacks.get(),
                                        &skipped_gc_iterations,
                                        kMaxSkipGCIterations,
                                        kDebugPrints,
                                        data_to_delete,
                                        dex_files_to_delete);
}

}  // namespace fuzzer
}  // namespace art

Messung V0.5 in Prozent
C=92 H=87 G=89

¤ Dauer der Verarbeitung: 0.9 Sekunden  (vorverarbeitet am  2026-06-29) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.