Page MenuHomeFreeBSD

Fix undefined pointer arithmetic in fread()
AbandonedPublic

Authored by arichardson on Aug 2 2021, 2:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 1 2025, 5:36 PM
Unknown Object (File)
Feb 28 2025, 1:08 AM
Unknown Object (File)
Feb 25 2025, 6:27 AM
Unknown Object (File)
Feb 22 2025, 2:36 PM
Unknown Object (File)
Feb 22 2025, 8:00 AM
Unknown Object (File)
Feb 7 2025, 9:56 PM
Unknown Object (File)
Jan 25 2025, 4:03 PM
Unknown Object (File)
Jan 19 2025, 8:10 PM
Subscribers

Details

Reviewers
pfg
Summary

lib/libc/stdio/fread.c:133:10: runtime error: applying zero offset to null pointer

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40806
Build 37695: arc lint + arc unit

Event Timeline

Good.

Please also take a look at NetBSD's change 1.23, "Avoid undefined behavior in fread(3)".

This revision is now accepted and ready to land.Aug 2 2021, 3:02 PM
In D31383#707328, @pfg wrote:

Good.

Please also take a look at NetBSD's change 1.23, "Avoid undefined behavior in fread(3)".

Ah nice, that avoids the branch inside the loop. Should I apply the NetBSD change instead?

In D31383#707328, @pfg wrote:

Good.

Please also take a look at NetBSD's change 1.23, "Avoid undefined behavior in fread(3)".

Ah nice, that avoids the branch inside the loop. Should I apply the NetBSD change instead?

I think so ... I haven't had time to test the change .. plus they undid it and then redid it in other commits. :-).

Similar patch (D33903) has been committed.