Hacker News new | ask | show | jobs
by laserbeam 1635 days ago
To be fair, the issue is not that there are too many physical cores, or that someone set that constant to 128. The issue is the code that spawns 1 thread per core doesn't check that constant to limit how many threads it spawns.
1 comments

One would wonder what this game is planning to do with 128 threads running simultaneously.
Does it matter? The 128 assumption for these kind of things is there just to allocate a fixed array of 128 thread ids, and going outside that array is a out of bounds magic with pointers.

It's totally reasonable to have a limit. It's totally reasonable to make that limit way higher than you'd think you'd ever need. It's only a bug if you don't enforce thay limit and fail to check for it. And, it's really easy to forget to do that when the easiest way to verify thesr bugs is "wait 15 years until hardware improves".

It’s totally not reasonable to have a variable number of things and to store them in a fixed length array. That’s how you get vulnerabilities.

At least check if is going to fit and crash otherwise.