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@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page
>From fa166dd1365589ee2fc60bfd46f8e4450aebdd7c Mon Sep 17 00:00:00 2001
From: Jaak Ristioja <j...@ristioja.ee>
Date: Mon, 19 Oct 2020 17:33:02 +0300
Subject: [PATCH] SWCompress: Re-added accidentally removed pointer check
The incorrect change was introduced in SVN 3754.
Signed-off-by: Jaak Ristioja <j...@ristioja.ee>
---
src/modules/common/swcomprs.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/common/swcomprs.cpp b/src/modules/common/swcomprs.cpp
index 255c2e20..27ac4dea 100644
--- a/src/modules/common/swcomprs.cpp
+++ b/src/modules/common/swcomprs.cpp
@@ -83,7 +83,7 @@ void SWCompress::setUncompressedBuf(const char *ibuf, unsigned long *len) {
buf = (char *)calloc(1,1); // be sure we at least allocate an empty buf for return;
direct = 1;
decode();
- *len = slen;
+ if (len) *len = slen;
}
}
--
2.28.0
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page