[git commit] decompress_gunzip: simplify ERR_RET bit clearing

Denys Vlasenko vda.linux at googlemail.com
Mon May 3 12:58:32 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=147ac93a065e215545488337efbaa6dceebc04d0
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

My gcc is in fact clever enough to do it itself, but let's be explicit

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 archival/libarchive/decompress_gunzip.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
index e93cd5005..d051ecb81 100644
--- a/archival/libarchive/decompress_gunzip.c
+++ b/archival/libarchive/decompress_gunzip.c
@@ -230,9 +230,8 @@ static void huft_free(huft_t *p)
 	 * If 'p' has the error bit set we have to clear it, otherwise we might run
 	 * into a segmentation fault or an invalid pointer to free(p)
 	 */
-	if (BAD_HUFT(p)) {
-		p = (huft_t*)((uintptr_t)(p) ^ (uintptr_t)(ERR_RET));
-	}
+	//if (BAD_HUFT(p)) // commented out, since bit clearing has effect only if condition is true
+		p = (huft_t*)((uintptr_t)p & ~(uintptr_t)ERR_RET);
 
 	/* Go through linked list, freeing from the malloced (t[-1]) address. */
 	while (p) {


More information about the busybox-cvs mailing list