[sword-devel] Accidental removal of code in SVN 3754?

Jaak Ristioja jaak at ristioja.ee
Mon Oct 19 11:20:11 EDT 2020


Nevermind, I saw you already applied the change.

J

On 19.10.20 17:35, Jaak Ristioja wrote:
> Hmm, interesting. It seems that the diff pasted was generated by passing 
> --ignore-space-change and --ignore-all-space to "git show" (e.g. "git 
> show -w -b") which resulted in the output I posted. Sorry for the 
> confusion. Attached is the patch.
> 
> Best regards,
> J
> 
> 
> On 19.10.20 16:42, Troy A. Griffitts wrote:
>> Hi Jaak,
>>
>> I just did an:
>>
>> svn diff -r3753:3754
>>
>> and don't see this change as you show it but do see the same result of 
>> your patch and the patch I get from the svn diff.  This does leave a 
>> *len = slen, which also seems to me dangerous.  I also am having a bit 
>> of trouble following this code, but certainly a check of len before 
>> setting *len seems appropriate.  I will commit it with the patch from 
>> your next email.
>>
>>
>> On 10/19/20 2:46 PM, Jaak Ristioja wrote:
>>> Hi!
>>>
>>> It seems that SVN 3754 might accidentally have removed a line of code 
>>> together with the preceding comment in SWCompress::setUncompressedBuf():
>>>
>>>         if (!buf) {
>>>                 buf = (char *)calloc(1,1); // be sure we at least 
>>> allocate an empty buf for return;
>>>                 direct = 1;
>>>                 decode();
>>> -//             slen = strlen(buf);
>>> -               if (len)
>>>                 *len = slen;
>>>         }
>>>
>>> To be honest I must say it is difficult to understand this code, but 
>>> I'm a bit puzzled about this change nevertheless. As far as I can 
>>> tell, the len pointer might be null, and this check would prevent it 
>>> from being dereferenced. Or does the API have a hidden contract that 
>>> if !ibuf then len!=nullptr?
>>>
>>>
>>> Best regards,
>>> J
>>> _______________________________________________
>>> sword-devel mailing list: sword-devel at crosswire.org
>>> http://crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
> 
> 
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
> 



More information about the sword-devel mailing list