Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (!base_addr.IsValid()) {
return nullptr;
}
So this still doesn't prove that the offset is withing the object, just that it hasn't overflowed. So it's still unsafe to smuggle a pointer in this manner,
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
inline const void* DecodePointer(const uint64_t* offset) {
@ajgo - how do we validate the result of this before use?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
inline const void* DecodePointer(const uint64_t* offset) {
@ajgo - how do we validate the result of this before use?
mojo does a validation pass before its decoding pass e.g. https://source.chromium.org/chromium/chromium/src/+/main:mojo/public/cpp/bindings/lib/map_data_internal.h;drc=a416f377ead3d8c361b97126daf78381344937dd;bpv=1;bpt=1;l=52 so adding more validation here might not be appropriate
Generated with gemini-cli
what was the prompt and how did you teach it about mojo serialization?
inline const void* DecodePointer(const uint64_t* offset) {
Alex Gough@ajgo - how do we validate the result of this before use?
mojo does a validation pass before its decoding pass e.g. https://source.chromium.org/chromium/chromium/src/+/main:mojo/public/cpp/bindings/lib/map_data_internal.h;drc=a416f377ead3d8c361b97126daf78381344937dd;bpv=1;bpt=1;l=52 so adding more validation here might not be appropriate
Ah. So in theory, we could write:
```
UNSAFE_BUFFER_USAGE inline const void* DecodePointer(const uint64_t* offset) {
if (!*offset)
return nullptr;
// SAFETY: required from caller, enforced by UNSAFE_BUFFER_USAGE.
return UNSAFE_BUFFERS(reinterpret_cast<const char*>(offset) + *offset);
}
```
but then you play the game of writing // PRECONDITIONS: comments in the callers.
Commit-Queue | +1 |
Generated with gemini-cli
what was the prompt and how did you teach it about mojo serialization?
The prompt and tools for the fix generation can be found here: agents/prompts/projects/spanification/. There is not a specific mojo serialization knowledge. Please, is there any specification consideration for mojo spanification?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
inline const void* DecodePointer(const uint64_t* offset) {
Alex Gough@ajgo - how do we validate the result of this before use?
Tom Sepezmojo does a validation pass before its decoding pass e.g. https://source.chromium.org/chromium/chromium/src/+/main:mojo/public/cpp/bindings/lib/map_data_internal.h;drc=a416f377ead3d8c361b97126daf78381344937dd;bpv=1;bpt=1;l=52 so adding more validation here might not be appropriate
Ah. So in theory, we could write:
```
UNSAFE_BUFFER_USAGE inline const void* DecodePointer(const uint64_t* offset) {
if (!*offset)
return nullptr;
// SAFETY: required from caller, enforced by UNSAFE_BUFFER_USAGE.
return UNSAFE_BUFFERS(reinterpret_cast<const char*>(offset) + *offset);
}
```
but then you play the game of writing // PRECONDITIONS: comments in the callers.
I think it would be reasonable to mark `DecodePointer()` (and maybe `EncodePointer()`) as unsafe and similarly force `Pointer::Get()` and `Pointer::Set()` to be unsafe as well.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |