That code hasn't really been stress tested or qualified properly.  I submitted 
some changes to the os_unix.c sources to address this and some other issues 
(proxyGetHostID now uses the gethostuuid() system api).  The changes I 
submitted are significant and are still undergoing review prior to integration 
on trunk. I don't know if/when those changes will be pulled into the main 
repository trunk (I do know it's a significant effort to fully review, audit 
and ensure test & branch coverage).

- adam

On Jan 19, 2010, at 12:40 AM, Jens Miltner wrote:

> 
> Am 16.01.2010 um 19:00 schrieb Thomas Stüfe:
> 
>> Greetings,
>> 
>> I think I found a small bug in sqlite 3.6.22 in the function  
>> proxyGetHostID().
>> 
>> There, pread() and pwrite() are used to read a host id file. Return  
>> value of these functions is assigned to a size_t variable. size_t is  
>> unsigned. Should pread fail for any reason (IO Error or whatever)  
>> and return -1, the error handling would not kick in. Instead, the  
>> function would probably just leave the host id uninitialized and  
>> return ok.
>> 
>> A valid fix might be using ssize_t (signed size_t) instead of  
>> size_t, but I cannot of course say whether this would work on all  
>> platforms.
> 
> AFAICS, this is for Mac OS X only anyway...
> pread returns an ssize_t according to the docs, so the proposed change  
> looks safe to me...
> 
> Another potential problem is when for some reason the hostid file is  
> empty: in this case pread will return 0, which will leave pHostID  
> uninitialized, too.
> It will return a result code, but the OSTRACE3 inside proxyGetHostID  
> still attempts to dump the host ID, which at this point will be  
> uninitialized.
> 
> 
>> 
>> My Platform is MacOS X, I compile with gcc 4.2. I compile the  
>> amalgamation for sqlite 3.6.22. I only found this because gcc warns:
>> 
>> sqlite3.c:26120: warning: comparison of unsigned expression < 0 is  
>> always false
>> sqlite3.c:26134: warning: comparison of unsigned expression < 0 is  
>> always false
> 
> 
> </jum>
> 
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to