From 16f2ab5a9eec07e3c48235b6becb14597fb2903c Mon Sep 17 00:00:00 2001 From: febo Date: Mon, 1 Jun 2026 17:27:30 +0100 Subject: [PATCH 1/2] Add note --- program/src/state/buffer.rs | 4 ++++ program/src/state/data.rs | 4 ++++ program/src/state/header.rs | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/program/src/state/buffer.rs b/program/src/state/buffer.rs index 19da923..72df2eb 100644 --- a/program/src/state/buffer.rs +++ b/program/src/state/buffer.rs @@ -9,6 +9,10 @@ use super::{Account, AccountDiscriminator, ZeroableOption, SEED_LEN}; /// Buffer account header. /// /// A buffer holds a variable amount of data after its header information. +// +// Note: `Buffer` may be loaded directly from account data after only a +// length check (no owner check). All fields must be valid for any bit +// pattern. #[repr(C)] pub struct Buffer { /// Account discriminator. diff --git a/program/src/state/data.rs b/program/src/state/data.rs index b2918ed..ae71438 100644 --- a/program/src/state/data.rs +++ b/program/src/state/data.rs @@ -3,6 +3,10 @@ use pinocchio::{error::ProgramError, Address}; use super::{DataSource, ZeroableOption}; /// Metadata account data. +// +// Note: `Data` may be loaded directly from account data after only a +// length check (no owner check). All fields must be valid for any bit +// pattern. pub enum Data<'a> { /// Represents the case where the metadata is stored on the account. Direct(DirectData<'a>), diff --git a/program/src/state/header.rs b/program/src/state/header.rs index 4613b9e..d78b4a7 100644 --- a/program/src/state/header.rs +++ b/program/src/state/header.rs @@ -10,6 +10,10 @@ use super::{ }; /// Metadata account header. +// +// Note: `Header` may be loaded directly from account data after only a +// length check (no owner check). All fields must be valid for any bit +// pattern. #[repr(C)] pub struct Header { /// Account discriminator. From b53fc943cd5766676004d0f32c3977120edd1239 Mon Sep 17 00:00:00 2001 From: febo Date: Tue, 2 Jun 2026 10:33:18 +0100 Subject: [PATCH 2/2] Move comment --- program/src/state/data.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/program/src/state/data.rs b/program/src/state/data.rs index ae71438..7d51859 100644 --- a/program/src/state/data.rs +++ b/program/src/state/data.rs @@ -3,10 +3,6 @@ use pinocchio::{error::ProgramError, Address}; use super::{DataSource, ZeroableOption}; /// Metadata account data. -// -// Note: `Data` may be loaded directly from account data after only a -// length check (no owner check). All fields must be valid for any bit -// pattern. pub enum Data<'a> { /// Represents the case where the metadata is stored on the account. Direct(DirectData<'a>), @@ -55,6 +51,10 @@ pub struct UrlData<'a>(pub &'a str); /// /// External data contains a reference (address) to an external account /// and an offset and an optional length to specify the data range. +// +// Note: `ExternalData` may be loaded directly from account data after +// only a length check (no owner check). All fields must be valid for any +// bit pattern. #[repr(C)] pub struct ExternalData { /// Address of the external account.