#115296 broke include_bytes! on paths with untrustworthy metadata #115458
Labels
C-bug
Category: This is a bug.
P-high
High priority
regression-from-stable-to-nightly
Performance or correctness regression from stable to nightly.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In #115296 this diff is subtly broken:
because it trusts that the size of the file returned by
File::metadata
is trustworthy, and it does not need to be. The correct implementation is to callread
until EOF is reached.This can be observed by trying to
include_bytes!("/dev/random")
(just be sure to use the resultantconst
).The text was updated successfully, but these errors were encountered: