my code.(on windows)
And after that, access members of that struct and do some calculations.
Simetines this cast results to null. And if I access those members of struct, I'll get a segfault.
How ensure about validity of these kinds of casts?
check against null before accessing it
I checked it. It's always not null but dereftencing it willy cause segfault.
maybe it's a read after free
https://stackoverflow.com/questions/42588482/c-accessing-data-after-memory-has-been-freeed
https://en.m.wikipedia.org/wiki/Dangling_pointer
Обсуждают сегодня