Hacker News new | past | comments | ask | show | jobs | submit login

There are similar approaches, ie: Checked-C which work surprisingly well. However, I'm not sure that this approach would be expressive enough to handle the edge cases of C craziness and pointer arithmetic. There's more to memory unsafety than writing to unallocated memory, even forcing a write to slightly wrong memory (ie setting `is_admin = true`) can be catastrophic.



I think it handles all standards-conforming uses of pointer arithmetic. Even systems-level stuff like coercing an address used for memory-mapped IO may work. For example,

    struct dev { int a, b; } *p; p = (struct dev *) 0x12345678; 
should be able to set up p with bounds that allow access only to the a and b fields - eg, producing an error with

    int *q = (int *) p; q[2] = 0;
Of course, it doesn't fix logic errors, such as setting a flag to true that shouldn't be set to true.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: