Comment

Comment by ragnot

This paper will help a lot: https://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf

tl;dr: Remember that the "new" operator does two operations: allocates memory and fills in the memory with the data. Now, if you have two threads (A & B):

- A allocates memory and then gets pre-empted

- B will pass the null pointer check and attempt to use the non-filled in memory block

parent ragnot 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton