[evolution-patches] Re: [patch] another 64-bit bug-fix



>>>>> On Wed, 15 Dec 2004 11:08:54 +0800, Not Zed <notzed ximian com> said:

  Michael> I'm curious, why does this lead to a crash?  That value is
  Michael> never used other than to test against zero, I can't see how
  Michael> it could cause a crash since the cast only changes the type
  Michael> size.

Ugh, the code changed more since Evolution v2.0.3 than a quick scan of
the code seemed to suggest.  In v2.0.3, the crash came about because
the truncated value was used in a call to g_object_new().  That isn't
the case anymore in the CVS tree, so I agree that the current code won't
crash anymore.

However, the code still looks wrong to me: if I read it correctly, the
"kinds" hash table is a mapping from:

	icalcomponent_kind -> ECalBackendFactory *

By casting the result of g_hash_table_lookup() to an "int", you lose
the top 32 bits, so if you're unlucky enough to get an
ECalBackendFactory pointer that's aligned to 4GB, the code could fail
to detect that a method has already been registered.  Perhaps a minor
bug, but why not cast the result of the hash lookup to
(ECalBackendFactory *)?

Thanks,

	--david



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]