Running `make test` with Clang sanitizers results in some issues with
unaligned pointers surrounding some uses of buffers cast to a size_t*.
The sanitizers used were `-fsanitize=undefined -fsanitize=address`.

I believe the issues flagged below are undefined behavior.

<---snip--->
seed
cbc128.c:91:5: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
cbc128.c:146:18: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 36  c8 b2 e1 af f7 e6 93 83  13 31 66 e3 e7 64 81 5f  82 5a 18 1b b9
96 8e 57  3f d6 ac 16 3f 7c cc
              ^
seed base64
cbc128.c:91:5: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
cbc128.c:146:18: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 2f  f3 03 15 e2 33 5b 84 44  39 3a 4c 34 50 b8 30 5b  1a 37 45 ef 2f
f7 dd bf  47 f2 7f 25 7e f9 cf
              ^
seed-cbc
cbc128.c:91:5: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
cbc128.c:146:18: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 0c  0f 82 b4 ed 90 12 93 63  93 b2 af d5 b7 b5 2c b6  8a 36 8b 22 ef
12 cd 18  06 39 75 10 66 6d 38
              ^
seed-cbc base64
cbc128.c:91:5: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
cbc128.c:146:18: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 47  90 50 6c 24 ea a3 b6 62  e4 01 e6 4a 17 ed e3 d7  19 ff de a9 ee
f1 38 2f  84 07 18 2e e0 10 b4
              ^
seed-cfb
cfb128.c:94:27: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
cfb128.c:93:5: runtime error: store to misaligned address
0x6210000191cf for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191cf: note: pointer points here
 d3 99 f6 e3 c0  54 d7 be 9b ea 14 ff 9f  98 09 5a de 67 fa 46 1a  30
59 50 fa 42 2c d5 db  1d 51 c2
             ^
cfb128.c:138:16: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 14  b8 62 44 63 65 8b cb 53  5c 49 ac 26 37 f5 70 ce  49 0a cb 95 40
60 31 5d  d3 da 09 a7 80 01 a4
              ^
cfb128.c:139:5: runtime error: store to misaligned address
0x6210000191c3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191c3: note: pointer points here
 00  65 73 74 62 69 6e 2f 73  68 0a 0a 74 65 73 74 73  72 63 3d 74 65
73 74 65  6e 63 0a 74 65 73 74
              ^
seed-cfb base64
cfb128.c:94:27: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
cfb128.c:93:5: runtime error: store to misaligned address
0x6210000191cf for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191cf: note: pointer points here
 25 f0 49 d8 32  6e 82 3b b8 4c 69 93 e5  79 1a 71 42 ba 80 a7 18  1a
7e c5 23 53 33 cb 5b  ce 63 02
             ^
cfb128.c:138:16: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 2b  5e 4e d4 e8 fd c9 ab 4b  8b 9e 18 42 f9 51 19 43  2d 67 8d fd 5c
80 94 5b  b8 a2 cf 23 77 b8 1b
              ^
cfb128.c:139:5: runtime error: store to misaligned address
0x6210000191c3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191c3: note: pointer points here
 00  65 73 74 62 69 6e 2f 73  68 0a 0a 74 65 73 74 73  72 63 3d 74 65
73 74 65  6e 63 0a 74 65 73 74
              ^
seed-ecb
seed-ecb base64
seed-ofb
ofb128.c:93:5: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
ofb128.c:92:5: runtime error: store to misaligned address
0x6210000191cf for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191cf: note: pointer points here
 7b 7f 75 f0 fc  05 e4 56 0e 3f 92 57 4e  2b 24 93 be 76 f5 49 0c  2b
c1 f7 c6 52 f6 d1 45  ee 55 47
             ^
ofb128.c:93:5: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 1f  0b ec ae 33 a6 15 ad d8  2e 8a dd a0 04 79 8c 49  60 f8 33 25 fe
ad 85 9d  38 8b a6 23 5e e6 f0
              ^
ofb128.c:92:5: runtime error: store to misaligned address
0x6210000191c3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191c3: note: pointer points here
 00  65 73 74 62 69 6e 2f 73  68 0a 0a 74 65 73 74 73  72 63 3d 74 65
73 74 65  6e 63 0a 74 65 73 74
              ^
seed-ofb base64
ofb128.c:93:5: runtime error: load of misaligned address
0x611000006e4f for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x611000006e4f: note: pointer points here
 74 65 73 74 20  3e 20 24 74 65 73 74 2e  63 69 70 68 65 72 0a 24  63
6d 64 20 65 6e 63 20  3c 20 24
             ^
ofb128.c:92:5: runtime error: store to misaligned address
0x6210000191cf for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191cf: note: pointer points here
 15 20 93 74 7b  a3 81 3e 94 0c 1b 31 dc  63 41 64 0a 0c 6f 23 17  d6
22 5b 53 07 eb 3f af  7c 25 96
             ^
ofb128.c:93:5: runtime error: load of misaligned address
0x61200000afc3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x61200000afc3: note: pointer points here
 0f  34 94 6a c6 7d b7 49 8d  4c b5 df c2 c7 64 fe af  4c 5b 4a 52 b8
5f 5f 34  dc 21 e7 c2 ef 96 4c
              ^
ofb128.c:92:5: runtime error: store to misaligned address
0x6210000191c3 for type 'size_t' (aka 'unsigned long'), which requires
8 byte alignment
0x6210000191c3: note: pointer points here
 00  65 73 74 62 69 6e 2f 73  68 0a 0a 74 65 73 74 73  72 63 3d 74 65
73 74 65  6e 63 0a 74 65 73 74
              ^

*****
$ /usr/local/bin/clang -v
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

$ apps/openssl version -a
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
OpenSSL 1.1.0-dev xx XXX xxxx
built on: Wed Jul  2 20:05:35 EDT 2014
platform: darwin64-x86_64-cc
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: /usr/local/bin/clang -DOPENSSL_THREADS -D_REENTRANT
-DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -arch x86_64 -O3
-DL_ENDIAN -Wall -fsanitize=undefined -fsanitize=address
-DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5
-DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM
-DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
OPENSSLDIR: "/usr/local/ssl"

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to