[sword-devel] Accidental removal of code in SVN 3754?
Jaak Ristioja
jaak at ristioja.ee
Mon Oct 19 10:35:50 EDT 2020
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SWCompress-Re-added-accidentally-removed-pointer-che.patch
Type: text/x-patch
Size: 871 bytes
Desc: not available
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20201019/c9cec803/attachment.bin>
More information about the sword-devel
mailing list