This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 478cf8b
committed
fs: Don't dereference a pointer to a too-small allocation
ptr::addr_of!((*ptr).field) still requires ptr to point to an
appropriate allocation for its type. Since the pointer returned by
readdir() can be smaller than sizeof(struct dirent), we need to entirely
avoid dereferencing it as that type.
Link: rust-lang/miri#1981 (comment)
Link: rust-lang#93459 (comment)1 parent 5bd1ec3 commit 478cf8b
1 file changed
+9
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
494 | 500 | | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
| 501 | + | |
| 502 | + | |
499 | 503 | | |
500 | 504 | | |
501 | | - | |
| 505 | + | |
502 | 506 | | |
503 | 507 | | |
504 | 508 | | |
| |||
0 commit comments