Skip to content
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

Undefined behavior in dos_rw_record_fcb #77

Open
johnsonjh opened this issue Oct 19, 2024 · 1 comment
Open

Undefined behavior in dos_rw_record_fcb #77

johnsonjh opened this issue Oct 19, 2024 · 1 comment

Comments

@johnsonjh
Copy link
Collaborator

johnsonjh commented Oct 19, 2024

From Cppcheck v2.15.0:

src/dos.c:388:53: error: Read and write operations without a call to a positioning function (fseek, fsetpos or rewind) or
 fflush in between result in undefined behaviour. [IOWithoutPositioning]
    unsigned n = write ? fwrite(buf, 1, rsize, f) : fread(buf, 1, rsize, f);
                                                    ^
@dmsc
Copy link
Owner

dmsc commented Oct 19, 2024

I don't know if this is valid - as we only read or write to the file depending on the DOS call, so if a DOS program mixes reads and writes without a flush, is there a valid behaviour?

I will think on a way to actually flush the file when detecting mixed reads or writes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants