MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w2m4qz/bugintroduceddebugging/p6vp3xx/?context=9999
r/ProgrammerHumor • u/ClipboardCopyPaste • 2d ago
120 comments sorted by
View all comments
342
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?
155 u/atanasius 2d ago It's allowed to assign to a pointer if it's not dereferenced. Malloc always returns a valid pointer. 52 u/vishal340 2d ago but accessing it will be issue right? 6 u/mckenzie_keith 2d ago You are not allowed to de-reference a pointer after freeing it. 9 u/GoddammitDontShootMe 2d ago Gemini added that return *x; that wasn't in the original code. 8 u/mckenzie_keith 2d ago And then flagged it as a bug. It was so eager to find the bug that it added it into the code.
155
It's allowed to assign to a pointer if it's not dereferenced. Malloc always returns a valid pointer.
52 u/vishal340 2d ago but accessing it will be issue right? 6 u/mckenzie_keith 2d ago You are not allowed to de-reference a pointer after freeing it. 9 u/GoddammitDontShootMe 2d ago Gemini added that return *x; that wasn't in the original code. 8 u/mckenzie_keith 2d ago And then flagged it as a bug. It was so eager to find the bug that it added it into the code.
52
but accessing it will be issue right?
6 u/mckenzie_keith 2d ago You are not allowed to de-reference a pointer after freeing it. 9 u/GoddammitDontShootMe 2d ago Gemini added that return *x; that wasn't in the original code. 8 u/mckenzie_keith 2d ago And then flagged it as a bug. It was so eager to find the bug that it added it into the code.
6
You are not allowed to de-reference a pointer after freeing it.
9 u/GoddammitDontShootMe 2d ago Gemini added that return *x; that wasn't in the original code. 8 u/mckenzie_keith 2d ago And then flagged it as a bug. It was so eager to find the bug that it added it into the code.
9
Gemini added that return *x; that wasn't in the original code.
return *x;
8 u/mckenzie_keith 2d ago And then flagged it as a bug. It was so eager to find the bug that it added it into the code.
8
And then flagged it as a bug. It was so eager to find the bug that it added it into the code.
342
u/AdBrave2400 2d ago
Is the mistake that they're allocating 1 byte and storing in a pointer to an int which is 4 bytes?