Hi,
I tried


sh postfix-env.sh valgrind --tool=memcheck src/global/mail_dict redis:$(pwd)/redis.cf read<<'EOF'


With redis.cf


host = 127.0.0.1

port = 6379

prefix = TEST:


With “get foo”, or any command like postmap I get segmentation fault (see attached output)



So I created test.sh with:


#!/bin/sh

postfix start

postmap -q "postmas...@example.com" redis:$(pwd)/redis.cf

postmap -q "postmas...@test.com" redis:$(pwd)/redis.cf

postfix stop


Redis only has the key:


"TEST:postmas...@test.com" set to "u...@test.com"


Run with  valgrind --tool=memcheck ./test.sh


I get attached output


Sorry, I tried looking through Makefile as well and could not get test to work apart from with script.


Duncan

/home/builder/aport/src/postfix-3.6-20210224 # sh postfix-env.sh valgrind 
--tool=memcheck src/global/mail_dict redis:$(pwd)/redis.cf read<<'EOF'
> get foo
> EOF
==673== Memcheck, a memory error detector
==673== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==673== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==673== Command: src/global/mail_dict 
redis:/home/builder/aport/src/postfix-3.6-20210224/redis.cf read
==673== 
==673== Invalid read of size 1
==673==    at 0x48C5FA4: strlen (vg_replace_strmem.c:459)
==673==    by 0x4943B57: concatenate (in 
/home/builder/aport/src/postfix-3.6-20210224/lib/libpostfix-util.so)
==673==    by 0x108C1B: mail_dict_init (in 
/home/builder/aport/src/postfix-3.6-20210224/src/global/mail_dict)
==673==    by 0x108A8F: main (in 
/home/builder/aport/src/postfix-3.6-20210224/src/global/mail_dict)
==673==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==673== 
==673== 
==673== Process terminating with default action of signal 11 (SIGSEGV): dumping 
core
==673==  Access not within mapped region at address 0x0
==673==    at 0x48C5FA4: strlen (vg_replace_strmem.c:459)
==673==    by 0x4943B57: concatenate (in 
/home/builder/aport/src/postfix-3.6-20210224/lib/libpostfix-util.so)
==673==    by 0x108C1B: mail_dict_init (in 
/home/builder/aport/src/postfix-3.6-20210224/src/global/mail_dict)
==673==    by 0x108A8F: main (in 
/home/builder/aport/src/postfix-3.6-20210224/src/global/mail_dict)
==673==  If you believe this happened as a result of a stack
==673==  overflow in your program's main thread (unlikely but
==673==  possible), you can try to increase the size of the
==673==  main thread stack using the --main-stacksize= flag.
==673==  The main thread stack size used in this run was 8388608.
==673== 
==673== HEAP SUMMARY:
==673==     in use at exit: 72,704 bytes in 1 blocks
==673==   total heap usage: 1 allocs, 0 frees, 72,704 bytes allocated
==673== 
==673== LEAK SUMMARY:
==673==    definitely lost: 0 bytes in 0 blocks
==673==    indirectly lost: 0 bytes in 0 blocks
==673==      possibly lost: 0 bytes in 0 blocks
==673==    still reachable: 72,704 bytes in 1 blocks
==673==         suppressed: 0 bytes in 0 blocks
==673== Rerun with --leak-check=full to see details of leaked memory
==673== 
==673== For lists of detected and suppressed errors, rerun with: -s
==673== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault

/home/builder/aport/src/postfix-3.6-20210224 # redis-cli keys "*"
1) "TEST:postmas...@test.com"
/home/builder/aport/src/postfix-3.6-20210224 # redis-cli get 
"TEST:postmas...@test.com"
"u...@test.com"
/home/builder/aport/src/postfix-3.6-20210224 # valgrind --tool=memcheck 
./test.sh
==588== Memcheck, a memory error detector
==588== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==588== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==588== Command: ./test.sh
==588== 
postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf 
compatibility_level=3.6" and "postfix reload"
postfix/postfix-script: starting the Postfix mail system
==658== 
==658== HEAP SUMMARY:
==658==     in use at exit: 5,407 bytes in 21 blocks
==658==   total heap usage: 24 allocs, 3 frees, 5,559 bytes allocated
==658== 
==658== LEAK SUMMARY:
==658==    definitely lost: 0 bytes in 0 blocks
==658==    indirectly lost: 0 bytes in 0 blocks
==658==      possibly lost: 0 bytes in 0 blocks
==658==    still reachable: 5,407 bytes in 21 blocks
==658==         suppressed: 0 bytes in 0 blocks
==658== Rerun with --leak-check=full to see details of leaked memory
==658== 
==658== For lists of detected and suppressed errors, rerun with: -s
==658== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==660== 
==660== HEAP SUMMARY:
==660==     in use at exit: 5,438 bytes in 22 blocks
==660==   total heap usage: 28 allocs, 6 frees, 6,238 bytes allocated
==660== 
==660== LEAK SUMMARY:
==660==    definitely lost: 0 bytes in 0 blocks
==660==    indirectly lost: 0 bytes in 0 blocks
==660==      possibly lost: 0 bytes in 0 blocks
==660==    still reachable: 5,438 bytes in 22 blocks
==660==         suppressed: 0 bytes in 0 blocks
==660== Rerun with --leak-check=full to see details of leaked memory
==660== 
==660== For lists of detected and suppressed errors, rerun with: -s
==660== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
u...@test.com
postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf 
compatibility_level=3.6" and "postfix reload"
postfix/postfix-script: stopping the Postfix mail system
==588== 
==588== HEAP SUMMARY:
==588==     in use at exit: 5,411 bytes in 21 blocks
==588==   total heap usage: 29 allocs, 8 frees, 6,739 bytes allocated
==588== 
==588== LEAK SUMMARY:
==588==    definitely lost: 0 bytes in 0 blocks
==588==    indirectly lost: 0 bytes in 0 blocks
==588==      possibly lost: 0 bytes in 0 blocks
==588==    still reachable: 5,411 bytes in 21 blocks
==588==         suppressed: 0 bytes in 0 blocks
==588== Rerun with --leak-check=full to see details of leaked memory
==588== 
==588== For lists of detected and suppressed errors, rerun with: -s
==588== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)



Reply via email to