froggy icon indicating copy to clipboard operation
froggy copied to clipboard

Is this unsound?

Open nico-abram opened this issue 6 years ago • 2 comments

These no-bounds-checking indexing operations on Storage: https://github.com/kvark/froggy/blob/master/src/lib.rs#L252-L269

I get that they're only so on release, but I'd expect the bounds checking to also happen on release by default (As is common in rust). Maybe a flag to disable it would make more sense

nico-abram avatar Sep 27 '19 01:09 nico-abram

Sure looks unsound to me. I think this was your example from Discord:

let mut storage = froggy::Storage::new();
let ptr1 = storage.create(1i32);
storage[&ptr1] = 2i32;
let mut storage2 = froggy::Storage::new();
storage2[&ptr1] = 2i32;

MaulingMonkey avatar Sep 27 '19 01:09 MaulingMonkey

Yes, you are correct. We should keep the checks.

kvark avatar Sep 27 '19 12:09 kvark