rswier / c4

C in four functions
GNU General Public License v2.0
9.64k stars 1.42k forks source link

10 = 666; considered legal #72

Open tommythorn opened 2 years ago

tommythorn commented 2 years ago

I cut my teeth on Small-C eons ago and c4 is an absolute delight and very clever. However, I did think the lvalue trick looked too fragile and indeed, if you generate just the right constant, like 9 or 10, you can trick it.

int main(int argc, char **argv) {
    10 = 666;
}

This compiles and will lead to stack corruption.

Definitely not hard to fix and probably not worthwhile.