Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca84dfa

Browse files
committed
Prevent Valgrind Memcheck errors around px_acquire_system_randomness().
This function uses uninitialized stack and heap buffers as supplementaryentropy sources. Mark them so Memcheck will not complain. Back-patchto 9.4, where Valgrind Memcheck cooperation first appeared.Marko Tiikkaja
1 parent258e294 commitca84dfa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎contrib/pgcrypto/random.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include"postgres.h"
3333

3434
#include"px.h"
35+
#include"utils/memdebug.h"
3536

3637
/* how many bytes to ask from system random provider */
3738
#defineRND_BYTES 32
@@ -195,16 +196,18 @@ try_unix_std(uint8 *dst)
195196
memcpy(dst, (uint8*)&x,sizeof(x));
196197
dst+=sizeof(x);
197198

198-
/*let's be desperate */
199+
/*hash of uninitialized stack and heap allocations */
199200
res=px_find_digest("sha1",&md);
200201
if (res >=0)
201202
{
202203
uint8*ptr;
203204
uint8stack[8192];
204205
intalloc=32*1024;
205206

207+
VALGRIND_MAKE_MEM_DEFINED(stack,sizeof(stack));
206208
px_md_update(md,stack,sizeof(stack));
207209
ptr=px_alloc(alloc);
210+
VALGRIND_MAKE_MEM_DEFINED(ptr,alloc);
208211
px_md_update(md,ptr,alloc);
209212
px_free(ptr);
210213

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp