diff --git a/core/embed/rust/src/micropython/buffer.rs b/core/embed/rust/src/micropython/buffer.rs index 9cf330ad1c..f0365872b7 100644 --- a/core/embed/rust/src/micropython/buffer.rs +++ b/core/embed/rust/src/micropython/buffer.rs @@ -196,6 +196,8 @@ fn get_buffer_info(obj: Obj, flags: u32) -> Result /// (a) no mutable reference to the same buffer is held at the same time, /// (b) the buffer is not modified in MicroPython while the reference to it is /// being held. +/// The returned value is NOT guaranteed to be a head pointer, so the +/// destination might get GC'd. Do not store the reference. pub unsafe fn get_buffer<'a>(obj: Obj) -> Result<&'a [u8], Error> { let bufinfo = get_buffer_info(obj, ffi::MP_BUFFER_READ)?; @@ -221,6 +223,8 @@ pub unsafe fn get_buffer<'a>(obj: Obj) -> Result<&'a [u8], Error> { /// (a) no other reference to the same buffer is held at the same time, /// (b) the buffer is not modified in MicroPython while the reference to it is /// being held. +/// The returned value is NOT guaranteed to be a head pointer, so the +/// destination might get GC'd. Do not store the reference. pub unsafe fn get_buffer_mut<'a>(obj: Obj) -> Result<&'a mut [u8], Error> { let bufinfo = get_buffer_info(obj, ffi::MP_BUFFER_WRITE)?;