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

Jaak Ristioja jaak at ristioja.ee
Mon Oct 19 08:46:56 EDT 2020


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


More information about the sword-devel mailing list