Re: Null pointer in __vptr

2021-11-22 Thread frame via Digitalmars-d-learn
On Monday, 22 November 2021 at 13:21:22 UTC, bauss wrote: Seems like it was only partially fixed then, specifically for missing abstract methods, but not whether the signature was correct or not. Seems like a critical bug to me. At least it's still present in dmd 2.098.

Re: Null pointer in __vptr

2021-11-22 Thread bauss via Digitalmars-d-learn
On Friday, 19 November 2021 at 20:27:11 UTC, frame wrote: On Friday, 19 November 2021 at 18:14:03 UTC, Adam D Ruppe wrote: I've gotten that before as a result of a compiler bug... I had an abstract method that wasn't implemented but the compile time error got swallowed by a bug and thus the

Re: Null pointer in __vptr

2021-11-21 Thread frame via Digitalmars-d-learn
On Sunday, 21 November 2021 at 02:43:12 UTC, Ali Çehreli wrote: There are some offset arithmetic involved to get to the right vtbl pointer but the pointer of an object cannot be stored anywhere in the vtbl because there is just one vtbl but very many objects. Ok, so they mean by instance is

Re: Null pointer in __vptr

2021-11-20 Thread Ali Çehreli via Digitalmars-d-learn
On 11/20/21 7:19 AM, frame wrote: > I think this is true for an object instance. But from an interface > instance, the object instance must be accessible somewhere? Everything needed is available from the pointer to a class object (or interface). There are some offset arithmetic involved to

Re: Null pointer in __vptr

2021-11-20 Thread frame via Digitalmars-d-learn
On Friday, 19 November 2021 at 21:09:16 UTC, Ali Çehreli wrote: I am not sure that's correct. The way I picture it, the code reaches the __vptr by following a pointer; so it's already known. Additionally, I am under the impression that there is only one __vptr for a given type, which all

Re: Null pointer in __vptr

2021-11-19 Thread Ali Çehreli via Digitalmars-d-learn
On 11/19/21 10:04 AM, frame wrote: > On Friday, 19 November 2021 at 15:46:41 UTC, Adam D Ruppe wrote: > >> The `destroy` function (as well as other class destruction) will null >> out the whole vtable to help make use-after-free an obvious error. >> Possible that happened to you. > > So, a

Re: Null pointer in __vptr

2021-11-19 Thread frame via Digitalmars-d-learn
On Friday, 19 November 2021 at 18:14:03 UTC, Adam D Ruppe wrote: I've gotten that before as a result of a compiler bug... I had an abstract method that wasn't implemented but the compile time error got swallowed by a bug and thus the null method made its way to the binary. You got it! It

Re: Null pointer in __vptr

2021-11-19 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 19 November 2021 at 18:04:17 UTC, frame wrote: So, a partial nulled table shouldn't exist, right? like this: Indeed. I've gotten that before as a result of a compiler bug... I had an abstract method that wasn't implemented but the compile time error got swallowed by a bug and

Re: Null pointer in __vptr

2021-11-19 Thread frame via Digitalmars-d-learn
On Friday, 19 November 2021 at 15:46:41 UTC, Adam D Ruppe wrote: The `destroy` function (as well as other class destruction) will null out the whole vtable to help make use-after-free an obvious error. Possible that happened to you. So, a partial nulled table shouldn't exist, right? like

Re: Null pointer in __vptr

2021-11-19 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 19 November 2021 at 15:37:59 UTC, frame wrote: Is a null pointer entry in the __vptr[] valid or always a sign for corruption/wrong cast somewhere? thx The `destroy` function (as well as other class destruction) will null out the whole vtable to help make use-after-free an obvious