Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merged in trunk for fuzz.c changes. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | markdown-footnotes |
| Files: | files | file ages | folders |
| SHA3-256: |
c9f4013530c0f721e6f784f2dcba7730 |
| User & Date: | stephan 2022-04-20 11:48:21.479 |
Context
|
2022-04-20
| ||
| 14:07 | Added a missing blob initializer. ... (check-in: 7209593814 user: stephan tags: markdown-footnotes) | |
| 11:48 | Merged in trunk for fuzz.c changes. ... (check-in: c9f4013530 user: stephan tags: markdown-footnotes) | |
| 11:46 | Correct fuzz.c to honor --fuzztype markdown and add --fuzztype wiki2 which works like its previous --fuzztype wiki behavior, sending all inputs through both the fossil-wiki and markdown translators. Added a fatal error for --fuzztype artifact, as that tester is not implemented. ... (check-in: 8d4c479208 user: stephan tags: trunk) | |
|
2022-04-19
| ||
| 15:25 | Remove unnecessary field from the auxiliary union <code>'bitfield64_t'</code> and amend the corresponding comments. Also add comment about FOOTNOTES_WITHOUT_URI macro. ... (check-in: cf1e96918e user: george tags: markdown-footnotes) | |
Changes
Changes to src/fuzz.c.
| ︙ | ︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
#if LOCAL_INTERFACE
/*
** Type of fuzzing:
*/
#define FUZZ_WIKI 0 /* The Fossil-Wiki formatter */
#define FUZZ_MARKDOWN 1 /* The Markdown formatter */
#define FUZZ_ARTIFACT 2 /* Fuzz the artifact parser */
#endif
/* The type of fuzzing to do */
static int eFuzzType = FUZZ_WIKI;
/* The fuzzer invokes this routine once for each fuzzer input
*/
int LLVMFuzzerTestOneInput(const uint8_t *aData, size_t nByte){
Blob in, out;
blob_init(&in, 0, 0);
blob_append(&in, (char*)aData, (int)nByte);
blob_zero(&out);
switch( eFuzzType ){
case FUZZ_WIKI: {
Blob title = BLOB_INITIALIZER;
wiki_convert(&in, &out, 0);
blob_reset(&out);
markdown_to_html(&in, &title, &out);
blob_reset(&title);
break;
}
}
blob_reset(&in);
blob_reset(&out);
return 0;
}
/*
** Check fuzzer command-line options.
*/
static void fuzzer_options(void){
const char *zType;
db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0);
db_multi_exec("PRAGMA query_only=1;");
zType = find_option("fuzztype",0,1);
if( zType==0 || fossil_strcmp(zType,"wiki")==0 ){
eFuzzType = FUZZ_WIKI;
}else if( fossil_strcmp(zType,"markdown")==0 ){
eFuzzType = FUZZ_MARKDOWN;
}else{
fossil_fatal("unknown fuzz type: \"%s\"", zType);
}
}
/* Libfuzzer invokes this routine once prior to start-up to
** process command-line options.
*/
int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
expand_args_option(*pArgc, *pArgv);
fuzzer_options();
*pArgc = g.argc;
*pArgv = g.argv;
return 0;
}
/*
** COMMAND: test-fuzz
**
| > > > > > > > > > > > > > > > > > > | > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
#if LOCAL_INTERFACE
/*
** Type of fuzzing:
*/
#define FUZZ_WIKI 0 /* The Fossil-Wiki formatter */
#define FUZZ_MARKDOWN 1 /* The Markdown formatter */
#define FUZZ_ARTIFACT 2 /* Fuzz the artifact parser */
#define FUZZ_WIKI2 3 /* FOSSIL_WIKI and FOSSIL_MARKDOWN */
#endif
/* The type of fuzzing to do */
static int eFuzzType = FUZZ_WIKI;
/* The fuzzer invokes this routine once for each fuzzer input
*/
int LLVMFuzzerTestOneInput(const uint8_t *aData, size_t nByte){
Blob in, out;
blob_init(&in, 0, 0);
blob_append(&in, (char*)aData, (int)nByte);
blob_zero(&out);
switch( eFuzzType ){
case FUZZ_WIKI: {
wiki_convert(&in, &out, 0);
blob_reset(&out);
break;
}
case FUZZ_MARKDOWN: {
Blob title = BLOB_INITIALIZER;
blob_reset(&out);
markdown_to_html(&in, &title, &out);
blob_reset(&title);
break;
}
case FUZZ_WIKI2: {
Blob title = BLOB_INITIALIZER;
wiki_convert(&in, &out, 0);
blob_reset(&out);
markdown_to_html(&in, &title, &out);
blob_reset(&title);
break;
}
case FUZZ_ARTIFACT:
fossil_fatal("FUZZ_ARTIFACT is not implemented.");
break;
}
blob_reset(&in);
blob_reset(&out);
return 0;
}
/*
** Check fuzzer command-line options.
*/
static void fuzzer_options(void){
const char *zType;
db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0);
db_multi_exec("PRAGMA query_only=1;");
zType = find_option("fuzztype",0,1);
if( zType==0 || fossil_strcmp(zType,"wiki")==0 ){
eFuzzType = FUZZ_WIKI;
}else if( fossil_strcmp(zType,"markdown")==0 ){
eFuzzType = FUZZ_MARKDOWN;
}else if( fossil_strcmp(zType,"wiki2")==0 ){
eFuzzType = FUZZ_WIKI2;
}else{
fossil_fatal("unknown fuzz type: \"%s\"", zType);
}
}
/* Libfuzzer invokes this routine once prior to start-up to
** process command-line options.
*/
int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){
expand_args_option(*pArgc, *pArgv);
fuzzer_options();
*pArgc = g.argc;
*pArgv = g.argv;
return 0;
}
/*
** COMMAND: test-fuzz
**
** Usage: %fossil test-fuzz [-fuzztype TYPE] INPUTFILE...
**
** Run a fuzz test using INPUTFILE as the test data. TYPE can be one of:
**
** wiki Fuzz the Fossil-wiki translator
** markdown Fuzz the markdown translator
** artifact Fuzz the artifact parser
** wiki2 Fuzz the Fossil-wiki and markdown translator
*/
void fuzz_command(void){
Blob in;
int i;
fuzzer_options();
verify_all_options();
for(i=2; i<g.argc; i++){
blob_read_from_file(&in, g.argv[i], ExtFILE);
LLVMFuzzerTestOneInput((const uint8_t*)in.aData, (size_t)in.nUsed);
fossil_print("%s\n", g.argv[i]);
blob_reset(&in);
}
}
|
Changes to src/gzip.c.
| ︙ | ︙ | |||
27 28 29 30 31 32 33 |
#include "gzip.h"
/*
** State information for the GZIP file under construction.
*/
struct gzip_state {
int eState; /* 0: idle 1: header 2: compressing */
| | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
#include "gzip.h"
/*
** State information for the GZIP file under construction.
*/
struct gzip_state {
int eState; /* 0: idle 1: header 2: compressing */
unsigned long iCRC; /* The checksum */
z_stream stream; /* The working compressor */
Blob out; /* Results stored here */
} gzip;
/*
** Write a 32-bit integer as little-endian into the given buffer.
*/
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
2018 2019 2020 2021 2022 2023 2024 |
@ the administrator to run <b>fossil rebuild</b>.</p>
}
}else{
if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
load_control();
}
#ifdef FOSSIL_ENABLE_JSON
| > | | | | | > | 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 |
@ the administrator to run <b>fossil rebuild</b>.</p>
}
}else{
if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
load_control();
}
#ifdef FOSSIL_ENABLE_JSON
{
static int jsonOnce = 0;
if( jsonOnce==0 && g.json.isJsonMode!=0 ){
assert(json_is_bootstrapped_early());
json_bootstrap_late();
jsonOnce = 1;
}
}
#endif
if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){
cgi_decode_post_parameters();
}
if( g.fCgiTrace ){
fossil_trace("######## Calling %s #########\n", pCmd->zName);
|
| ︙ | ︙ |
Changes to src/zip.c.
| ︙ | ︙ | |||
253 254 255 256 257 258 259 |
const Blob *pFile,
int mPerm
){
z_stream stream;
int nameLen;
int toOut = 0;
int iStart;
| | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
const Blob *pFile,
int mPerm
){
z_stream stream;
int nameLen;
int toOut = 0;
int iStart;
unsigned long iCRC = 0;
int nByte = 0;
int nByteCompr = 0;
int nBlob; /* Size of the blob */
int iMethod; /* Compression method. */
int iMode = 0644; /* Access permissions */
char *z;
char zHdr[30];
|
| ︙ | ︙ |