mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Fix minor mistakes in old Guava models
Also add tests for the affected functions
This commit is contained in:
@@ -75,7 +75,7 @@ class TestBase {
|
||||
}
|
||||
|
||||
void test6() {
|
||||
sink(Suppliers.memoize(Suppliers.memoizeWithExpiration(Suppliers.synchronizedSupplier(Suppliers.ofInstance(taint())), 3, TimeUnit.HOURS))); // $numTaintFlow=1
|
||||
sink(Suppliers.memoize(Suppliers.memoizeWithExpiration(Suppliers.synchronizedSupplier(Suppliers.ofInstance(taint())), 3, TimeUnit.HOURS)).get()); // $numTaintFlow=1
|
||||
}
|
||||
|
||||
void test7() {
|
||||
|
||||
@@ -8,7 +8,11 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.Closeable;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.channels.WritableByteChannel;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.io.IOException;
|
||||
|
||||
class TestIO {
|
||||
@@ -16,6 +20,7 @@ class TestIO {
|
||||
String staint(){ return (String) taint(); }
|
||||
byte[] btaint() { return (byte[]) taint(); }
|
||||
InputStream itaint() { return (InputStream) taint(); }
|
||||
ReadableByteChannel rbctaint() { return (ReadableByteChannel) taint(); }
|
||||
Reader rtaint() { return new InputStreamReader(itaint()); }
|
||||
Path ptaint() { return (Path) taint(); }
|
||||
|
||||
@@ -75,6 +80,16 @@ class TestIO {
|
||||
}
|
||||
|
||||
void test3() throws IOException {
|
||||
{
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteStreams.copy(itaint(), out);
|
||||
sink(out); // $numTaintFlow=1
|
||||
}
|
||||
{
|
||||
WritableByteChannel out = FileChannel.open(Paths.get("/tmp/xyz"));
|
||||
ByteStreams.copy(rbctaint(), out);
|
||||
sink(out); // $numTaintFlow=1
|
||||
}
|
||||
sink(ByteStreams.limit(itaint(), 1337)); // $numTaintFlow=1
|
||||
sink(ByteStreams.newDataInput(btaint())); // $numTaintFlow=1
|
||||
sink(ByteStreams.newDataInput(btaint(), 0)); // $numTaintFlow=1
|
||||
|
||||
Reference in New Issue
Block a user