Commit 979e51f7 authored by Ceyhun Alp's avatar Ceyhun Alp

Fixing clang_format issues

parent 80ec81ec
Pipeline #217460 failed with stage
in 8 minutes and 7 seconds
This diff is collapsed.
......@@ -34,12 +34,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
doc->set_subject(poppler::ustring::from_latin1(in_sub));
doc->set_title(poppler::ustring::from_latin1(in_title));
doc->set_author(poppler::ustring::from_utf8((const char*)data,size));
doc->set_creator(poppler::ustring::from_utf8((const char*)data,size));
doc->set_keywords(poppler::ustring::from_utf8((const char*)data,size));
doc->set_producer(poppler::ustring::from_utf8((const char*)data,size));
doc->set_subject(poppler::ustring::from_utf8((const char*)data,size));
doc->set_title(poppler::ustring::from_utf8((const char*)data,size));
doc->set_author(poppler::ustring::from_utf8((const char *)data, size));
doc->set_creator(poppler::ustring::from_utf8((const char *)data, size));
doc->set_keywords(poppler::ustring::from_utf8((const char *)data, size));
doc->set_producer(poppler::ustring::from_utf8((const char *)data, size));
doc->set_subject(poppler::ustring::from_utf8((const char *)data, size));
doc->set_title(poppler::ustring::from_utf8((const char *)data, size));
delete doc;
return 0;
......
......@@ -26,56 +26,57 @@
// Pure-C interface for creating and cleaning up temporary files.
static char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {
char* filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
if (!filename_buffer) {
perror("Failed to allocate file name buffer.");
abort();
}
const int file_descriptor = mkstemp(filename_buffer);
if (file_descriptor < 0) {
perror("Failed to make temporary file.");
abort();
}
FILE* file = fdopen(file_descriptor, "wb");
if (!file) {
perror("Failed to open file descriptor.");
close(file_descriptor);
abort();
}
const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
if (bytes_written < size) {
close(file_descriptor);
fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)",
bytes_written, size);
abort();
}
fclose(file);
return filename_buffer;
static char *fuzzer_get_tmpfile(const uint8_t *data, size_t size)
{
char *filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
if (!filename_buffer) {
perror("Failed to allocate file name buffer.");
abort();
}
const int file_descriptor = mkstemp(filename_buffer);
if (file_descriptor < 0) {
perror("Failed to make temporary file.");
abort();
}
FILE *file = fdopen(file_descriptor, "wb");
if (!file) {
perror("Failed to open file descriptor.");
close(file_descriptor);
abort();
}
const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
if (bytes_written < size) {
close(file_descriptor);
fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)", bytes_written, size);
abort();
}
fclose(file);
return filename_buffer;
}
static void fuzzer_release_tmpfile(char* filename) {
if (unlink(filename) != 0) {
perror("WARNING: Failed to delete temporary file.");
}
free(filename);
static void fuzzer_release_tmpfile(char *filename)
{
if (unlink(filename) != 0) {
perror("WARNING: Failed to delete temporary file.");
}
free(filename);
}
// C++ RAII object for creating temporary files.
#ifdef __cplusplus
class FuzzerTemporaryFile {
public:
FuzzerTemporaryFile(const uint8_t* data, size_t size)
: filename_(fuzzer_get_tmpfile(data, size)) {}
class FuzzerTemporaryFile
{
public:
FuzzerTemporaryFile(const uint8_t *data, size_t size) : filename_(fuzzer_get_tmpfile(data, size)) { }
~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }
~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }
const char* filename() const { return filename_; }
const char *filename() const { return filename_; }
private:
char* filename_;
private:
char *filename_;
};
#endif
#endif // FUZZER_TEMP_FILE_H_
#endif // FUZZER_TEMP_FILE_H_
......@@ -19,7 +19,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
poppler::page_renderer r;
for (int i = 0; i < doc->pages(); i++) {
poppler::ustring label = poppler::ustring::from_utf8((const char*)data, size);
poppler::ustring label = poppler::ustring::from_utf8((const char *)data, size);
poppler::page *p = doc->create_page(label);
if (!p) {
continue;
......
......@@ -24,7 +24,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
continue;
}
poppler::rectf rect = p->page_rect();
poppler::ustring text = poppler::ustring::from_utf8((const char*)data, size);
poppler::ustring text = poppler::ustring::from_utf8((const char *)data, size);
p->search(text, rect, poppler::page::search_from_top, poppler::case_insensitive, poppler::rotate_0);
r.render_page(p);
delete p;
......
......@@ -5,7 +5,8 @@
#include "fuzzer_temp_file.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
GError *err = NULL;
PopplerDocument *doc;
PopplerPage *page;
......
#include <stdint.h>
#include <poppler.h>
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
GError *err = NULL;
PopplerDocument *doc;
PopplerPage *page;
......
#include <stdint.h>
#include <poppler.h>
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
GError *err = NULL;
PopplerDocument *doc;
PopplerPage *page;
......
......@@ -26,56 +26,57 @@
// Pure-C interface for creating and cleaning up temporary files.
static char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {
char* filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
if (!filename_buffer) {
perror("Failed to allocate file name buffer.");
abort();
}
const int file_descriptor = mkstemp(filename_buffer);
if (file_descriptor < 0) {
perror("Failed to make temporary file.");
abort();
}
FILE* file = fdopen(file_descriptor, "wb");
if (!file) {
perror("Failed to open file descriptor.");
close(file_descriptor);
abort();
}
const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
if (bytes_written < size) {
close(file_descriptor);
fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)",
bytes_written, size);
abort();
}
fclose(file);
return filename_buffer;
static char *fuzzer_get_tmpfile(const uint8_t *data, size_t size)
{
char *filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
if (!filename_buffer) {
perror("Failed to allocate file name buffer.");
abort();
}
const int file_descriptor = mkstemp(filename_buffer);
if (file_descriptor < 0) {
perror("Failed to make temporary file.");
abort();
}
FILE *file = fdopen(file_descriptor, "wb");
if (!file) {
perror("Failed to open file descriptor.");
close(file_descriptor);
abort();
}
const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
if (bytes_written < size) {
close(file_descriptor);
fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)", bytes_written, size);
abort();
}
fclose(file);
return filename_buffer;
}
static void fuzzer_release_tmpfile(char* filename) {
if (unlink(filename) != 0) {
perror("WARNING: Failed to delete temporary file.");
}
free(filename);
static void fuzzer_release_tmpfile(char *filename)
{
if (unlink(filename) != 0) {
perror("WARNING: Failed to delete temporary file.");
}
free(filename);
}
// C++ RAII object for creating temporary files.
#ifdef __cplusplus
class FuzzerTemporaryFile {
public:
FuzzerTemporaryFile(const uint8_t* data, size_t size)
: filename_(fuzzer_get_tmpfile(data, size)) {}
class FuzzerTemporaryFile
{
public:
FuzzerTemporaryFile(const uint8_t *data, size_t size) : filename_(fuzzer_get_tmpfile(data, size)) { }
~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }
~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }
const char* filename() const { return filename_; }
const char *filename() const { return filename_; }
private:
char* filename_;
private:
char *filename_;
};
#endif
#endif // FUZZER_TEMP_FILE_H_
#endif // FUZZER_TEMP_FILE_H_
#include <stdint.h>
#include <poppler.h>
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
GError *err = NULL;
PopplerDocument *doc;
PopplerPage *page;
......
......@@ -5,7 +5,8 @@
#include "fuzzer_temp_file.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
GError *err = NULL;
PopplerDocument *doc;
PopplerPage *page;
......@@ -54,7 +55,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (status != CAIRO_STATUS_SUCCESS) {
g_object_unref(page);
continue;
}
if (hg) {
cairo_set_source_rgb(cr, 0.6, 0.6, 1.0);
......
#include <stdint.h>
#include <poppler.h>
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
gsize length;
poppler_named_dest_from_bytestring(data, size);
poppler_named_dest_to_bytestring(data, &length);
......
This diff is collapsed.
......@@ -26,56 +26,57 @@
// Pure-C interface for creating and cleaning up temporary files.
static char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {
char* filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
if (!filename_buffer) {
perror("Failed to allocate file name buffer.");
abort();
}
const int file_descriptor = mkstemp(filename_buffer);
if (file_descriptor < 0) {
perror("Failed to make temporary file.");
abort();
}
FILE* file = fdopen(file_descriptor, "wb");
if (!file) {
perror("Failed to open file descriptor.");
close(file_descriptor);
abort();
}
const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
if (bytes_written < size) {
close(file_descriptor);
fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)",
bytes_written, size);
abort();
}
fclose(file);
return filename_buffer;
static char *fuzzer_get_tmpfile(const uint8_t *data, size_t size)
{
char *filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
if (!filename_buffer) {
perror("Failed to allocate file name buffer.");
abort();
}
const int file_descriptor = mkstemp(filename_buffer);
if (file_descriptor < 0) {
perror("Failed to make temporary file.");
abort();
}
FILE *file = fdopen(file_descriptor, "wb");
if (!file) {
perror("Failed to open file descriptor.");
close(file_descriptor);
abort();
}
const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
if (bytes_written < size) {
close(file_descriptor);
fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)", bytes_written, size);
abort();
}
fclose(file);
return filename_buffer;
}
static void fuzzer_release_tmpfile(char* filename) {
if (unlink(filename) != 0) {
perror("WARNING: Failed to delete temporary file.");
}
free(filename);
static void fuzzer_release_tmpfile(char *filename)
{
if (unlink(filename) != 0) {
perror("WARNING: Failed to delete temporary file.");
}
free(filename);
}
// C++ RAII object for creating temporary files.
#ifdef __cplusplus
class FuzzerTemporaryFile {
public:
FuzzerTemporaryFile(const uint8_t* data, size_t size)
: filename_(fuzzer_get_tmpfile(data, size)) {}
class FuzzerTemporaryFile
{
public:
FuzzerTemporaryFile(const uint8_t *data, size_t size) : filename_(fuzzer_get_tmpfile(data, size)) { }
~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }
~FuzzerTemporaryFile() { fuzzer_release_tmpfile(filename_); }
const char* filename() const { return filename_; }
const char *filename() const { return filename_; }
private:
char* filename_;
private:
char *filename_;
};
#endif
#endif // FUZZER_TEMP_FILE_H_
#endif // FUZZER_TEMP_FILE_H_
......@@ -11,17 +11,17 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
const QColor color = QColor::fromRgb(0xAB, 0xCD, 0xEF);
char *tmpfile = fuzzer_get_tmpfile(data, size);
QByteArray in_data = QByteArray::fromRawData((const char*)data, size);
QByteArray in_data = QByteArray::fromRawData((const char *)data, size);
Poppler::Document *doc = Poppler::Document::loadFromData(in_data);
if (!doc || doc->isLocked()){
if (!doc || doc->isLocked()) {
delete doc;
fuzzer_release_tmpfile(tmpfile);
return 0;
}
for (int i = 0; i < doc->numPages(); i++) {
Poppler::Page* p = doc->page(i);
Poppler::Page *p = doc->page(i);
if (!p) {
continue;
}
......
......@@ -7,16 +7,16 @@ static void dummy_error_function(const QString &, const QVariant &) { }
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
Poppler::setDebugErrorFunction(dummy_error_function, QVariant());
QByteArray in_data = QByteArray::fromRawData((const char*)data, size);
QByteArray in_data = QByteArray::fromRawData((const char *)data, size);
Poppler::Document *doc = Poppler::Document::loadFromData(in_data);
if (!doc || doc->isLocked()){
if (!doc || doc->isLocked()) {
delete doc;
return 0;
}
for (int i = 0; i < doc->numPages(); i++) {
QString label = QString(in_data);
Poppler::Page* p = doc->page(label);
Poppler::Page *p = doc->page(label);
if (!p) {
continue;
}
......
......@@ -7,15 +7,15 @@ static void dummy_error_function(const QString &, const QVariant &) { }
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
Poppler::setDebugErrorFunction(dummy_error_function, QVariant());
QByteArray in_data = QByteArray::fromRawData((const char*)data, size);
QByteArray in_data = QByteArray::fromRawData((const char *)data, size);
Poppler::Document *doc = Poppler::Document::loadFromData(in_data);
if (!doc || doc->isLocked()){
if (!doc || doc->isLocked()) {
delete doc;
return 0;
}
for (int i = 0; i < doc->numPages(); i++) {
Poppler::Page* p = doc->page(i);
Poppler::Page *p = doc->page(i);
if (!p) {
continue;
}
......
......@@ -6,15 +6,15 @@ static void dummy_error_function(const QString &, const QVariant &) { }
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
Poppler::setDebugErrorFunction(dummy_error_function, QVariant());
QByteArray in_data = QByteArray::fromRawData((const char*)data, size);
QByteArray in_data = QByteArray::fromRawData((const char *)data, size);
Poppler::Document *doc = Poppler::Document::loadFromData(in_data);
if (!doc || doc->isLocked()){
if (!doc || doc->isLocked()) {
delete doc;
return 0;
}
for (int i = 0; i < doc->numPages(); i++) {
Poppler::Page* p = doc->page(i);
Poppler::Page *p = doc->page(i);
if (!p) {
continue;
}
......
......@@ -8,15 +8,15 @@ static void dummy_error_function(const QString &, const QVariant &) { }
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
Poppler::setDebugErrorFunction(dummy_error_function, QVariant());
QByteArray in_data = QByteArray::fromRawData((const char*)data, size);
QByteArray in_data = QByteArray::fromRawData((const char *)data, size);
Poppler::Document *doc = Poppler::Document::loadFromData(in_data);
if (!doc || doc->isLocked()){
if (!doc || doc->isLocked()) {
delete doc;
return 0;
}
for (int i = 0; i < doc->numPages(); i++) {
Poppler::Page* p = doc->page(i);
Poppler::Page *p = doc->page(i);
if (!p) {
continue;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment