Fossil SCM

Merged in trunk for fuzz.c changes.

stephan 2022-04-20 11:48 markdown-footnotes merge
Commit c9f4013530c0f721e6f784f2dcba773028f95dc187f4f61a18a445fbb09b9c2d
+20 -1
--- src/fuzz.c
+++ src/fuzz.c
@@ -59,10 +59,11 @@
5959
** Type of fuzzing:
6060
*/
6161
#define FUZZ_WIKI 0 /* The Fossil-Wiki formatter */
6262
#define FUZZ_MARKDOWN 1 /* The Markdown formatter */
6363
#define FUZZ_ARTIFACT 2 /* Fuzz the artifact parser */
64
+#define FUZZ_WIKI2 3 /* FOSSIL_WIKI and FOSSIL_MARKDOWN */
6465
#endif
6566
6667
/* The type of fuzzing to do */
6768
static int eFuzzType = FUZZ_WIKI;
6869
@@ -73,17 +74,32 @@
7374
blob_init(&in, 0, 0);
7475
blob_append(&in, (char*)aData, (int)nByte);
7576
blob_zero(&out);
7677
switch( eFuzzType ){
7778
case FUZZ_WIKI: {
79
+ wiki_convert(&in, &out, 0);
80
+ blob_reset(&out);
81
+ break;
82
+ }
83
+ case FUZZ_MARKDOWN: {
84
+ Blob title = BLOB_INITIALIZER;
85
+ blob_reset(&out);
86
+ markdown_to_html(&in, &title, &out);
87
+ blob_reset(&title);
88
+ break;
89
+ }
90
+ case FUZZ_WIKI2: {
7891
Blob title = BLOB_INITIALIZER;
7992
wiki_convert(&in, &out, 0);
8093
blob_reset(&out);
8194
markdown_to_html(&in, &title, &out);
8295
blob_reset(&title);
8396
break;
8497
}
98
+ case FUZZ_ARTIFACT:
99
+ fossil_fatal("FUZZ_ARTIFACT is not implemented.");
100
+ break;
85101
}
86102
blob_reset(&in);
87103
blob_reset(&out);
88104
return 0;
89105
}
@@ -98,10 +114,12 @@
98114
zType = find_option("fuzztype",0,1);
99115
if( zType==0 || fossil_strcmp(zType,"wiki")==0 ){
100116
eFuzzType = FUZZ_WIKI;
101117
}else if( fossil_strcmp(zType,"markdown")==0 ){
102118
eFuzzType = FUZZ_MARKDOWN;
119
+ }else if( fossil_strcmp(zType,"wiki2")==0 ){
120
+ eFuzzType = FUZZ_WIKI2;
103121
}else{
104122
fossil_fatal("unknown fuzz type: \"%s\"", zType);
105123
}
106124
}
107125
@@ -117,17 +135,18 @@
117135
}
118136
119137
/*
120138
** COMMAND: test-fuzz
121139
**
122
-** Usage: %fossil test-fuzz [-type TYPE] INPUTFILE...
140
+** Usage: %fossil test-fuzz [-fuzztype TYPE] INPUTFILE...
123141
**
124142
** Run a fuzz test using INPUTFILE as the test data. TYPE can be one of:
125143
**
126144
** wiki Fuzz the Fossil-wiki translator
127145
** markdown Fuzz the markdown translator
128146
** artifact Fuzz the artifact parser
147
+** wiki2 Fuzz the Fossil-wiki and markdown translator
129148
*/
130149
void fuzz_command(void){
131150
Blob in;
132151
int i;
133152
fuzzer_options();
134153
--- src/fuzz.c
+++ src/fuzz.c
@@ -59,10 +59,11 @@
59 ** Type of fuzzing:
60 */
61 #define FUZZ_WIKI 0 /* The Fossil-Wiki formatter */
62 #define FUZZ_MARKDOWN 1 /* The Markdown formatter */
63 #define FUZZ_ARTIFACT 2 /* Fuzz the artifact parser */
 
64 #endif
65
66 /* The type of fuzzing to do */
67 static int eFuzzType = FUZZ_WIKI;
68
@@ -73,17 +74,32 @@
73 blob_init(&in, 0, 0);
74 blob_append(&in, (char*)aData, (int)nByte);
75 blob_zero(&out);
76 switch( eFuzzType ){
77 case FUZZ_WIKI: {
 
 
 
 
 
 
 
 
 
 
 
 
78 Blob title = BLOB_INITIALIZER;
79 wiki_convert(&in, &out, 0);
80 blob_reset(&out);
81 markdown_to_html(&in, &title, &out);
82 blob_reset(&title);
83 break;
84 }
 
 
 
85 }
86 blob_reset(&in);
87 blob_reset(&out);
88 return 0;
89 }
@@ -98,10 +114,12 @@
98 zType = find_option("fuzztype",0,1);
99 if( zType==0 || fossil_strcmp(zType,"wiki")==0 ){
100 eFuzzType = FUZZ_WIKI;
101 }else if( fossil_strcmp(zType,"markdown")==0 ){
102 eFuzzType = FUZZ_MARKDOWN;
 
 
103 }else{
104 fossil_fatal("unknown fuzz type: \"%s\"", zType);
105 }
106 }
107
@@ -117,17 +135,18 @@
117 }
118
119 /*
120 ** COMMAND: test-fuzz
121 **
122 ** Usage: %fossil test-fuzz [-type TYPE] INPUTFILE...
123 **
124 ** Run a fuzz test using INPUTFILE as the test data. TYPE can be one of:
125 **
126 ** wiki Fuzz the Fossil-wiki translator
127 ** markdown Fuzz the markdown translator
128 ** artifact Fuzz the artifact parser
 
129 */
130 void fuzz_command(void){
131 Blob in;
132 int i;
133 fuzzer_options();
134
--- src/fuzz.c
+++ src/fuzz.c
@@ -59,10 +59,11 @@
59 ** Type of fuzzing:
60 */
61 #define FUZZ_WIKI 0 /* The Fossil-Wiki formatter */
62 #define FUZZ_MARKDOWN 1 /* The Markdown formatter */
63 #define FUZZ_ARTIFACT 2 /* Fuzz the artifact parser */
64 #define FUZZ_WIKI2 3 /* FOSSIL_WIKI and FOSSIL_MARKDOWN */
65 #endif
66
67 /* The type of fuzzing to do */
68 static int eFuzzType = FUZZ_WIKI;
69
@@ -73,17 +74,32 @@
74 blob_init(&in, 0, 0);
75 blob_append(&in, (char*)aData, (int)nByte);
76 blob_zero(&out);
77 switch( eFuzzType ){
78 case FUZZ_WIKI: {
79 wiki_convert(&in, &out, 0);
80 blob_reset(&out);
81 break;
82 }
83 case FUZZ_MARKDOWN: {
84 Blob title = BLOB_INITIALIZER;
85 blob_reset(&out);
86 markdown_to_html(&in, &title, &out);
87 blob_reset(&title);
88 break;
89 }
90 case FUZZ_WIKI2: {
91 Blob title = BLOB_INITIALIZER;
92 wiki_convert(&in, &out, 0);
93 blob_reset(&out);
94 markdown_to_html(&in, &title, &out);
95 blob_reset(&title);
96 break;
97 }
98 case FUZZ_ARTIFACT:
99 fossil_fatal("FUZZ_ARTIFACT is not implemented.");
100 break;
101 }
102 blob_reset(&in);
103 blob_reset(&out);
104 return 0;
105 }
@@ -98,10 +114,12 @@
114 zType = find_option("fuzztype",0,1);
115 if( zType==0 || fossil_strcmp(zType,"wiki")==0 ){
116 eFuzzType = FUZZ_WIKI;
117 }else if( fossil_strcmp(zType,"markdown")==0 ){
118 eFuzzType = FUZZ_MARKDOWN;
119 }else if( fossil_strcmp(zType,"wiki2")==0 ){
120 eFuzzType = FUZZ_WIKI2;
121 }else{
122 fossil_fatal("unknown fuzz type: \"%s\"", zType);
123 }
124 }
125
@@ -117,17 +135,18 @@
135 }
136
137 /*
138 ** COMMAND: test-fuzz
139 **
140 ** Usage: %fossil test-fuzz [-fuzztype TYPE] INPUTFILE...
141 **
142 ** Run a fuzz test using INPUTFILE as the test data. TYPE can be one of:
143 **
144 ** wiki Fuzz the Fossil-wiki translator
145 ** markdown Fuzz the markdown translator
146 ** artifact Fuzz the artifact parser
147 ** wiki2 Fuzz the Fossil-wiki and markdown translator
148 */
149 void fuzz_command(void){
150 Blob in;
151 int i;
152 fuzzer_options();
153
+1 -1
--- src/gzip.c
+++ src/gzip.c
@@ -29,11 +29,11 @@
2929
/*
3030
** State information for the GZIP file under construction.
3131
*/
3232
struct gzip_state {
3333
int eState; /* 0: idle 1: header 2: compressing */
34
- int iCRC; /* The checksum */
34
+ unsigned long iCRC; /* The checksum */
3535
z_stream stream; /* The working compressor */
3636
Blob out; /* Results stored here */
3737
} gzip;
3838
3939
/*
4040
--- src/gzip.c
+++ src/gzip.c
@@ -29,11 +29,11 @@
29 /*
30 ** State information for the GZIP file under construction.
31 */
32 struct gzip_state {
33 int eState; /* 0: idle 1: header 2: compressing */
34 int iCRC; /* The checksum */
35 z_stream stream; /* The working compressor */
36 Blob out; /* Results stored here */
37 } gzip;
38
39 /*
40
--- src/gzip.c
+++ src/gzip.c
@@ -29,11 +29,11 @@
29 /*
30 ** State information for the GZIP file under construction.
31 */
32 struct gzip_state {
33 int eState; /* 0: idle 1: header 2: compressing */
34 unsigned long iCRC; /* The checksum */
35 z_stream stream; /* The working compressor */
36 Blob out; /* Results stored here */
37 } gzip;
38
39 /*
40
+7 -5
--- src/main.c
+++ src/main.c
@@ -2020,15 +2020,17 @@
20202020
}else{
20212021
if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
20222022
load_control();
20232023
}
20242024
#ifdef FOSSIL_ENABLE_JSON
2025
- static int jsonOnce = 0;
2026
- if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2027
- assert(json_is_bootstrapped_early());
2028
- json_bootstrap_late();
2029
- jsonOnce = 1;
2025
+ {
2026
+ static int jsonOnce = 0;
2027
+ if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2028
+ assert(json_is_bootstrapped_early());
2029
+ json_bootstrap_late();
2030
+ jsonOnce = 1;
2031
+ }
20302032
}
20312033
#endif
20322034
if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){
20332035
cgi_decode_post_parameters();
20342036
}
20352037
--- src/main.c
+++ src/main.c
@@ -2020,15 +2020,17 @@
2020 }else{
2021 if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
2022 load_control();
2023 }
2024 #ifdef FOSSIL_ENABLE_JSON
2025 static int jsonOnce = 0;
2026 if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2027 assert(json_is_bootstrapped_early());
2028 json_bootstrap_late();
2029 jsonOnce = 1;
 
 
2030 }
2031 #endif
2032 if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){
2033 cgi_decode_post_parameters();
2034 }
2035
--- src/main.c
+++ src/main.c
@@ -2020,15 +2020,17 @@
2020 }else{
2021 if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
2022 load_control();
2023 }
2024 #ifdef FOSSIL_ENABLE_JSON
2025 {
2026 static int jsonOnce = 0;
2027 if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2028 assert(json_is_bootstrapped_early());
2029 json_bootstrap_late();
2030 jsonOnce = 1;
2031 }
2032 }
2033 #endif
2034 if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){
2035 cgi_decode_post_parameters();
2036 }
2037
+7 -5
--- src/main.c
+++ src/main.c
@@ -2020,15 +2020,17 @@
20202020
}else{
20212021
if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
20222022
load_control();
20232023
}
20242024
#ifdef FOSSIL_ENABLE_JSON
2025
- static int jsonOnce = 0;
2026
- if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2027
- assert(json_is_bootstrapped_early());
2028
- json_bootstrap_late();
2029
- jsonOnce = 1;
2025
+ {
2026
+ static int jsonOnce = 0;
2027
+ if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2028
+ assert(json_is_bootstrapped_early());
2029
+ json_bootstrap_late();
2030
+ jsonOnce = 1;
2031
+ }
20302032
}
20312033
#endif
20322034
if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){
20332035
cgi_decode_post_parameters();
20342036
}
20352037
--- src/main.c
+++ src/main.c
@@ -2020,15 +2020,17 @@
2020 }else{
2021 if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
2022 load_control();
2023 }
2024 #ifdef FOSSIL_ENABLE_JSON
2025 static int jsonOnce = 0;
2026 if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2027 assert(json_is_bootstrapped_early());
2028 json_bootstrap_late();
2029 jsonOnce = 1;
 
 
2030 }
2031 #endif
2032 if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){
2033 cgi_decode_post_parameters();
2034 }
2035
--- src/main.c
+++ src/main.c
@@ -2020,15 +2020,17 @@
2020 }else{
2021 if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
2022 load_control();
2023 }
2024 #ifdef FOSSIL_ENABLE_JSON
2025 {
2026 static int jsonOnce = 0;
2027 if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2028 assert(json_is_bootstrapped_early());
2029 json_bootstrap_late();
2030 jsonOnce = 1;
2031 }
2032 }
2033 #endif
2034 if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){
2035 cgi_decode_post_parameters();
2036 }
2037
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -255,11 +255,11 @@
255255
){
256256
z_stream stream;
257257
int nameLen;
258258
int toOut = 0;
259259
int iStart;
260
- int iCRC = 0;
260
+ unsigned long iCRC = 0;
261261
int nByte = 0;
262262
int nByteCompr = 0;
263263
int nBlob; /* Size of the blob */
264264
int iMethod; /* Compression method. */
265265
int iMode = 0644; /* Access permissions */
266266
--- src/zip.c
+++ src/zip.c
@@ -255,11 +255,11 @@
255 ){
256 z_stream stream;
257 int nameLen;
258 int toOut = 0;
259 int iStart;
260 int iCRC = 0;
261 int nByte = 0;
262 int nByteCompr = 0;
263 int nBlob; /* Size of the blob */
264 int iMethod; /* Compression method. */
265 int iMode = 0644; /* Access permissions */
266
--- src/zip.c
+++ src/zip.c
@@ -255,11 +255,11 @@
255 ){
256 z_stream stream;
257 int nameLen;
258 int toOut = 0;
259 int iStart;
260 unsigned long iCRC = 0;
261 int nByte = 0;
262 int nByteCompr = 0;
263 int nBlob; /* Size of the blob */
264 int iMethod; /* Compression method. */
265 int iMode = 0644; /* Access permissions */
266

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button