polytracker
polytracker copied to clipboard
Tainted control of `fseek` not properly tracked
int foo() {
FILE* input = fopen("foo", "rb");
int taintedOffset = getc(input);
fseek(input, taintedOffset, SEEK_SET);
return getc(input);
}
Currently, I believe the return value of foo() will only be tainted by the byte offset that was read. However, philosophically, I think it should also be tainted by the first byte in the file. This is even more important for tracking tainted file writes:
void foo(int writeOffset) {
FILE* input = fopen("foo", "wb");
fseek(input, writeOffset, SEEK_SET);
putc(SOME_CONSTANT);
fclose(input);
}
Right now, we would not say that the output file has any tainted bytes written to it, because only a constant is ever written. However, I think any taints from writeOffset should be transferred to the byte offset of the output file to which the constant is written.
This is almost the same as #6422 and #6426