Browse code

misc/fuzz: deeper parsing for From/To

Daniel-Constantin Mierla authored on 15/09/2021 09:01:45
Showing 1 changed files
... ...
@@ -2,6 +2,8 @@
2 2
 #include "../parser/parse_uri.c"
3 3
 #include "../parser/parse_hname2.h"
4 4
 #include "../parser/contact/parse_contact.h"
5
+#include "../parser/parse_from.h"
6
+#include "../parser/parse_to.h"
5 7
 #include "../parser/parse_refer_to.h"
6 8
 #include "../parser/parse_ppi_pai.h"
7 9
 #include "../parser/parse_privacy.h"
... ...
@@ -19,22 +21,29 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
19 21
     sip_msg_t orig_inv = { };
20 22
     orig_inv.buf = (char*)data;
21 23
     orig_inv.len = size;
24
+
22 25
     if (parse_msg(orig_inv.buf, orig_inv.len, &orig_inv) < 0) {
23 26
         goto cleanup;
24 27
     }
25
-  
28
+
29
+    parse_headers(&orig_inv, HDR_EOH_F, 0);
30
+
26 31
     parse_sdp(&orig_inv);
27 32
 
28
-    parse_headers(&orig_inv, HDR_TO_F, 0);
33
+    parse_from_header(&orig_inv);
34
+
35
+    parse_from_uri(&orig_inv);
36
+
37
+    parse_to_header(&orig_inv);
38
+
39
+    parse_to_uri(&orig_inv);
29 40
 
30 41
     parse_contact_header(&orig_inv);
31 42
 
32 43
     parse_refer_to_header(&orig_inv);
33 44
 
34
-    parse_to_header(&orig_inv);
35
-
36 45
     parse_pai_header(&orig_inv);
37
-    
46
+
38 47
     parse_diversion_header(&orig_inv);
39 48
 
40 49
     parse_privacy(&orig_inv);