[前][次][番号順一覧][スレッド一覧]

ruby-changes:69743

From: xtkoba <ko1@a...>
Date: Tue, 16 Nov 2021 19:42:50 +0900 (JST)
Subject: [ruby-changes:69743] fed65e6a48 (master): [ruby/digest] Avoid null pointer subtraction in digest/md5

https://git.ruby-lang.org/ruby.git/commit/?id=fed65e6a48

From fed65e6a48c5bed938c9bafb40409cd7e398f1c9 Mon Sep 17 00:00:00 2001
From: xtkoba <69125751+xtkoba@u...>
Date: Wed, 13 Oct 2021 08:40:48 -0700
Subject: [ruby/digest] Avoid null pointer subtraction in digest/md5

Fixes warning on Clang 13.

Fixes [Bug #18076]

https://github.com/ruby/digest/commit/32135c7487
---
 ext/digest/md5/md5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
index 19fe54a6934..3a7fe2cdad2 100644
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -225,7 +225,7 @@ md5_process(MD5_CTX *pms, const uint8_t *data /*[64]*/) https://github.com/ruby/ruby/blob/trunk/ext/digest/md5/md5.c#L225
     uint32_t xbuf[16];
     const uint32_t *X;
 
-    if (!((data - (const uint8_t *)0) & 3)) {
+    if (!(((uintptr_t)data) & 3)) {
 	/* data are properly aligned */
 	X = (const uint32_t *)data;
     } else {
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]