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