-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fuzz] Add Fuzz testing for RegistryPreview #37607
base: main
Are you sure you want to change the base?
Changes from 1 commit
b205794
8aefd45
88f5e65
5e28035
330e292
6ee7dba
d1b4fee
63724c8
a6a9f92
16c2c2b
f0951bb
11471bd
8ca1c2f
a7b8a27
ad15dd1
136b7ca
e8269b8
0438b20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This reverts commit e8269b8.
- Loading branch information
There are no files selected for viewing
+1 −0 | .gitattributes | |
+36 −19 | .github/workflows/build.yml | |
+2 −0 | .gitignore | |
+43 −23 | CMakeLists.txt | |
+1 −0 | CONTRIBUTING.md | |
+61 −5 | README.md | |
+8,122 −4,878 | src/miniz.h | |
+1,377 −1,065 | src/zip.c | |
+182 −65 | src/zip.h | |
+36 −7 | test/CMakeLists.txt | |
+370 −0 | test/minunit.h | |
+0 −671 | test/test.c | |
+96 −0 | test/test_append.c | |
+297 −0 | test/test_entry.c | |
+153 −0 | test/test_extract.c | |
+183 −0 | test/test_permissions.c | |
+140 −0 | test/test_read.c | |
+86 −0 | test/test_write.c |
+97 −0 | .github/workflows/ci.yml | |
+7 −1 | CMakeLists.txt | |
+32 −30 | README.md | |
+1 −1 | conanfile.py | |
+12 −3 | example/CMakeLists.txt | |
+23 −20 | include/nonstd/expected.hpp | |
+1 −0 | test/CMakeLists.txt | |
+6 −0 | test/expected-noexcept.t.cpp | |
+42 −0 | test/expected.t.cpp | |
+0 −0 | test/lest/lest.hpp | |
+2 −1 | test/t-noexcept.bat | |
+1 −1 | test/t.bat | |
+60 −0 | test/tc-cl.bat | |
+1 −1 | test/tc.bat | |
+1 −1 | test/tg.bat |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,9 @@ public static void FuzzCheckKeyLineForBrackets(ReadOnlySpan<byte> input) | |
string registryLine; | ||
|
||
// Simulate registry file content as filenameText | ||
var registryContent = GenerateRegistryHeader(input); | ||
var filenameText = GenerateRegistryHeader(input); | ||
|
||
string[] registryLines = registryContent.Split("\r"); | ||
string[] registryLines = filenameText.Split("\r"); | ||
|
||
if (registryLines.Length <= 1) | ||
{ | ||
|
@@ -75,9 +75,10 @@ public static void FuzzStripFirstAndLast(ReadOnlySpan<byte> input) | |
{ | ||
string registryLine; | ||
|
||
var regisrtyContent = GenerateRegistryHeader(input); | ||
var filenameText = GenerateRegistryHeader(input); | ||
|
||
string[] registryLines = regisrtyContent.Split("\r"); | ||
filenameText = filenameText.Replace("\r\n", "\r"); | ||
string[] registryLines = filenameText.Split("\r"); | ||
|
||
if (registryLines.Length <= 1) | ||
{ | ||
|
@@ -177,14 +178,16 @@ public static string GenerateRegistryHeader(ReadOnlySpan<byte> input) | |
string header = new Random().Next(2) == 0 ? REGISTRYHEADER4 : REGISTRYHEADER5; | ||
|
||
string inputText = System.Text.Encoding.UTF8.GetString(input); | ||
string registryContent = header + "\r" + inputText; | ||
string filenameText = header + "\r\n" + inputText; | ||
|
||
return registryContent; | ||
return filenameText.Replace("\r\n", "\r"); | ||
} | ||
|
||
private static bool IsValidRegistryHeader(string line) | ||
{ | ||
// Convert the line to lowercase once for comparison | ||
var lineLower = line.ToLowerInvariant(); | ||
|
||
switch (line) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that you're using switch (line), which relies on the original line, but you convert lineLower to lowercase for comparison. Which one do you actually intend to use? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I intend to use the line, and the lineLower needs to be removed. |
||
{ | ||
case REGISTRYHEADER4: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the comments, the result represents registry file content, so the name filenameText might be confusing. Would registryContent be a better choice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I also think so,registryContent would be a better choice than filenameText. I will modify it.