[Kde-pim] [patch] proposed fix for CID:3969 (kdepimlibs/kcal/icaltimezones.cpp)

David Jarvie djarvie at kde.org
Thu Jan 1 19:57:16 GMT 2009


On Thu 1 January 2009 11:13:48 Allen Winter wrote:
> On Thursday 01 January 2009 12:45:12 am Brad Hards wrote:
> > Apparently KTimezone::data() can return 0 (e.g. if !isValid()), in which
> > case ICalTimeZone::update() will dereference a null pointer.
> >
> > Is this fix OK, or am I missing something?
>
> Looks good.  Except I'm not sure if the !other.data() check should
> be done before the updateBase(other) call.  David??

Actually, a null data() value is perfectly valid (it just means that the time 
zone data hasn't been parsed yet). The only error is to call clone() without 
checking for null first. I've committed a fix (trunk and 4.1 branch) as 
follows:

--- icaltimezones.cpp   (revision 904278)
+++ icaltimezones.cpp   (working copy)
@@ -271,7 +271,8 @@
     return false;
   }

-  setData( other.data()->clone(), other.source() );
+  KTimeZoneData* otherData = other.data() ? other.data()->clone() : 0;
+  setData( otherData, other.source() );
   return true;
 }

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list