Skip to content

Commit b974cfb

Browse files
committed
corpus
1 parent 8a3db83 commit b974cfb

39 files changed

+3956
-8
lines changed

Sources/Fuzzilli/FuzzIL/Code.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ public struct Code: Collection {
241241
}
242242

243243
if instr.op is Await {
244-
if !contextAnalyzer.context.contains(.asyncFunction)
245-
{
246-
if contextAnalyzer.context.contains(.subroutine) {
247-
if !contextAnalyzer.context.contains(.method) && !contextAnalyzer.context.contains(.classMethod) {
248-
throw FuzzilliError.codeVerificationError("operation \(instr.op.name) inside an invalid context")
249-
}
250-
}
251-
}
244+
// if !contextAnalyzer.context.contains(.asyncFunction)
245+
// {
246+
// if contextAnalyzer.context.contains(.subroutine) {
247+
// if !contextAnalyzer.context.contains(.method) && !contextAnalyzer.context.contains(.classMethod) && !contextAnalyzer.context.contains(.javascript) {
248+
// throw FuzzilliError.codeVerificationError("operation \(instr.op.name) inside an invalid context")
249+
// }
250+
// }
251+
// }
252252
// fall-through allow top-level await
253253
} else {
254254
guard instr.op.requiredContext.isSubset(of: contextAnalyzer.context) else {

Sources/FuzzilliCli/Profiles/WorkerdProfile.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ let workerdProfile = Profile(
3939

4040
// Check that common crash types are detected.
4141
("fuzzilli('FUZZILLI_CRASH', 0)", .shouldCrash),
42+
("fuzzilli('FUZZILLI_CRASH', 2)", .shouldCrash),
43+
("fuzzilli('FUZZILLI_CRASH', 3)", .shouldCrash),
4244
],
4345

4446
additionalCodeGenerators: [],
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
function testAppend() {
3+
// Append operations
4+
let data = "This is a file containing a collection";
5+
var path2 = '/tmp/append.txt';
6+
fs.writeFileSync(path2, data);
7+
fs.appendFileSync(path2, ' appended');
8+
fs.readFileSync(path2);
9+
var readData = fs.readFileSync(path2, { encoding: 'utf8', flag: 'r' });
10+
console.log(readData);
11+
fs.unlinkSync(path2);
12+
}
13+
14+
testAppend();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
// Async callback operations
4+
function asyncCB() {
5+
let path = '/tmp/async.txt';
6+
fs.writeFile(path, 'async data', (err) => {
7+
if (!err) {
8+
fs.readFile(path, (err, data) => {
9+
if (!err) {
10+
fs.unlink(path, () => { });
11+
}
12+
});
13+
}
14+
});
15+
}
16+
17+
asyncCB();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Basic file operations
2+
function basicOps() {
3+
let path = '/tmp/test.txt';
4+
let content = 'Hello World';
5+
fs.writeFileSync(path, content);
6+
fs.readFileSync(path);
7+
fs.existsSync(path);
8+
fs.unlinkSync(path);
9+
}
10+
11+
basicOps();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Boundary conditions
2+
function boundaryCond() {
3+
let path = '/tmp/boundary.txt';
4+
fs.writeFileSync(path, ''); // Empty file
5+
let fd = fs.openSync(path, 'r+');
6+
fs.ftruncateSync(fd, 0);
7+
fs.closeSync(fd);
8+
fs.unlinkSync(path);
9+
}
10+
boundaryCond();
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Buffer edge cases
2+
function bufferTest() {
3+
let path = '/tmp/buf-edge.txt';
4+
let fd = fs.openSync(path, 'w+');
5+
6+
try {
7+
fs.writeSync(fd, Buffer.alloc(0));
8+
fs.writeSync(fd, Buffer.alloc(1, 255));
9+
} catch (e) { }
10+
11+
fs.closeSync(fd);
12+
fs.unlinkSync(path);
13+
fs.unlinkSync(path);
14+
fs.unlinkSync(path);
15+
fs.unlinkSync(path);
16+
}
17+
18+
bufferTest();
19+

workerd-corpus-fs/buffer-io.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function bufferIO() {
2+
// Buffer-based I/O operations
3+
let path = '/tmp/buffer.txt';
4+
let buffer = Buffer.from('binary data', 'utf8');
5+
fs.writeFileSync(path, buffer);
6+
let result = fs.readFileSync(path);
7+
fs.unlinkSync(path);
8+
}
9+
bufferIO();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function props() {
2+
// Computed property access
3+
let prop = 'Sync';
4+
let path = '/tmp/computed.txt';
5+
6+
fs['writeFile' + prop](path, 'computed');
7+
fs['readFile' + prop](path);
8+
fs['unlink' + prop](path);
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function timeout() {
2+
3+
// Concurrent file operations
4+
let path1 = '/tmp/concurrent1.txt';
5+
let path2 = '/tmp/concurrent2.txt';
6+
7+
fs.writeFile(path1, 'data1', () => { });
8+
fs.writeFile(path2, 'data2', () => { });
9+
10+
setTimeout(() => {
11+
try { fs.unlinkSync(path1); } catch (e) { }
12+
try { fs.unlinkSync(path2); } catch (e) { }
13+
}, 100);
14+
}

0 commit comments

Comments
 (0)