Eric Blake <ebl...@redhat.com> writes:

> On 11/10/2015 11:51 PM, Eric Blake wrote:
>> Previously, working with alternates required two lookup arrays
>> and some indirection: for type Foo, we created Foo_qtypes[]
>> which maps each qtype to a value of the generated FooKind enum,
>> then look up that value in FooKind_lookup[] like we do for other
>> union types.
>> 
>> This has a couple of subtle bugs.  First, the generator was
>> creating a call with a parameter '(int *) &(*obj)->type' where
>> type is an enum type; this is unsafe if the compiler chooses
>> to store the enum type in a different size than int, where
>> assigning through the wrong size pointer can corrupt data or
>> cause a SIGBUS.
>
> Yuck - we still have this bug for enums:
>
>> void visit_type_OnOffAuto(Visitor *v, OnOffAuto *obj, const char
>> *name, Error **errp)
>> {
>> visit_type_enum(v, (int *)obj, OnOffAuto_lookup, "OnOffAuto", name, errp);
>> }
>
> I guess I just added more work to my plate.
>
> But at the same time, no one has complained of the (int*)Enum causing
> SIGBUS on any of our platforms for either enums or alternates, so while
> we are doing gross things, I don't think we have to rush a fix into 2.5
> for this particular bug.

If it was a new bug, I'd push for fixing it in 2.5.  Since it's ancient,
I think we should leave it alone in 2.5.

Reply via email to