I tried to google this topic but most of them are conflicting each other. On the other side, I found a case where I can use either stack (local variable) or heap for a dynamic string. It's C by the way. Any strong reference regarding this topic?
Have you looked up the CVE database?– schroeder ♦May 31, 2022 at 8:23
The answer to this will change from month to month as more CVEs are created. Your best bet is to directly look at the database and count them.
However, many CVEs will identify as memory corruption or buffer overrun without identifying if it is stack or heap, and sometimes this is not clear as it could vary for the same bug depending on code use. Anything that identifies as "use after free" would be heap. There are likely other key phrases that would identify as stack, heap, either or neither.
Thanks for the clue. stack vs heap is 3439 vs 3533 as 2022-May-31 21:17 based on CVE database. That's really close and makes me think both have (almost) similar security "strength". May 31, 2022 at 14:18
1I think memory vulnerabilities are mostly in the called function, and frequently the memory is allocated in the calling function. The calling function could use heap or stack and the called fiction doesn't know the difference. So likely there's quite a few where it isn't heap or stack but either. This all an oversimplification. May 31, 2022 at 21:53