Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2015 23:33:29 -0400
From:      Vsevolod Stakhov <vsevolod@highsecure.ru>
To:        pkg@FreeBSD.org
Subject:   Problems found by infer
Message-ID:  <557A5309.40304@highsecure.ru>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello,

Facebook has released their tool to analyse C code and I've applied it
to pkg code. Here is a list of issues it has detected:

Starting analysis (Infer version v0.1.0)
Analysis done

119 files analyzed


external/libfetch/common.c:498: error: NULL_DEREFERENCE
   pointer host last assigned on line 496 could be null and is
dereferenced at line 498, column 2

external/libfetch/file.c:155: error: RESOURCE_LEAK
   resource acquired to dir by call to opendir() at line 134, column
13 is not released after line 155, column 2

external/libucl/src/ucl_hash.c:257: error: NULL_DEREFERENCE
   pointer it last assigned on line 256 could be null and is
dereferenced at line 257, column 3

external/libucl/src/ucl_util.c:1982: error: NULL_DEREFERENCE
   pointer vec last assigned on line 1983 could be null and is
dereferenced at line 1982, column 37

external/libucl/src/ucl_util.c:2059: error: NULL_DEREFERENCE
   pointer vec last assigned on line 39 could be null and is
dereferenced at line 2059, column 18

external/sqlite/sqlite3.c:131598: error: NULL_DEREFERENCE
   pointer xUnlockNotify last assigned on line 131534 could be null
and is dereferenced at line 131598, column 11

libpkg/fetch.c:341: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
341, column 13 is not reachable after line 341, column 2

libpkg/fetch.c:347: error: MEMORY_LEAK
   memory dynamically allocated to ssh_args by call to
pkg_object_string() at line 341, column 13 is not reachable after line
347, column 4

libpkg/packing.c:84: error: MEMORY_LEAK
   memory dynamically allocated to *pack by call to calloc() at line
65, column 15 is not reachable after line 84, column 4

libpkg/packing.c:310: error: NULL_DEREFERENCE
   pointer sb last assigned on line 299 could be null and is
dereferenced by call to sbuf_clear() at line 310, column 5

libpkg/pkg.c:1608: error: NULL_DEREFERENCE
   pointer dir last assigned on line 1605 could be null and is
dereferenced at line 1608, column 31

libpkg/pkg.c:1633: error: NULL_DEREFERENCE
   pointer f last assigned on line 1632 could be null and is
dereferenced at line 1633, column 7

libpkg/pkg_audit.c:335: error: NULL_DEREFERENCE
   pointer n last assigned on line 332 could be null and is
dereferenced at line 335, column 4

libpkg/pkg_delete.c:130: error: NULL_DEREFERENCE
   pointer tmp last assigned on line 129 could be null and is
dereferenced at line 130, column 3

libpkg/pkg_jobs.c:668: error: NULL_DEREFERENCE
   pointer d last assigned on line 667 could be null and is
dereferenced at line 668, column 46

libpkg/pkg_jobs_conflicts.c:455: error: MEMORY_LEAK
   memory dynamically allocated to k by call to
pkg_conflicts_sipkey_init() at line 453, column 7 is not reachable
after line 455, column 3

libpkg/pkg_jobs_universe.c:419: error: NULL_DEREFERENCE
   pointer c last assigned on line 306 could be null and is
dereferenced at line 419, column 54

libpkg/pkg_jobs_universe.c:419: error: NULL_DEREFERENCE
   pointer d last assigned on line 245 could be null and is
dereferenced at line 419, column 54

libpkg/pkg_jobs_universe.c:419: error: NULL_DEREFERENCE
   pointer p last assigned on line 487 could be null and is
dereferenced at line 419, column 54

libpkg/pkg_jobs_universe.c:419: error: NULL_DEREFERENCE
   pointer shlib last assigned on line 442 could be null and is
dereferenced at line 419, column 54

libpkg/pkg_jobs_universe.c:419: error: NULL_DEREFERENCE
   pointer c last assigned on line 726 could be null and is
dereferenced at line 419, column 54

libpkg/pkg_jobs_universe.c:846: error: NULL_DEREFERENCE
   pointer rd last assigned on line 845 could be null and is
dereferenced at line 846, column 45

libpkg/pkg_manifest.c:191: error: NULL_DEREFERENCE
   pointer *dest last assigned on line 184 could be null and is
dereferenced by call to sbuf_putc() at line 191, column 4

libpkg/pkg_manifest.c:212: error: NULL_DEREFERENCE
   pointer *dest last assigned on line 207 could be null and is
dereferenced by call to sbuf_putc() at line 212, column 4

libpkg/pkg_manifest.c:230: error: NULL_DEREFERENCE
   pointer *dest last assigned on line 207 could be null and is
dereferenced by call to sbuf_putc() at line 230, column 5

libpkg/pkg_ports.c:211: error: NULL_DEREFERENCE
   pointer tmp last assigned on line 210 could be null and is
dereferenced at line 211, column 2

libpkg/pkg_ports.c:965: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
965, column 16 is not reachable after line 965, column 2

libpkg/pkg_ports.c:967: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
967, column 17 is not reachable after line 967, column 3

libpkg/pkg_ports.c:970: error: MEMORY_LEAK
   memory dynamically allocated to keyword_dir by call to
pkg_object_string() at line 965, column 16 is not reachable after line
970, column 73

libpkg/pkg_printf.c:2883: error: MEMORY_LEAK
   memory dynamically allocated by call to sbuf_new() at line 2880,
column 41 is not reachable after line 2883, column 3

libpkg/pkg_printf.c:2928: error: MEMORY_LEAK
   memory dynamically allocated by call to sbuf_new() at line 2925,
column 41 is not reachable after line 2928, column 3

libpkg/pkg_printf.c:2977: error: MEMORY_LEAK
   memory dynamically allocated by call to sbuf_new() at line 2974,
column 41 is not reachable after line 2977, column 3

libpkg/pkg_printf.c:3031: error: MEMORY_LEAK
   memory dynamically allocated by call to sbuf_new() at line 3028,
column 41 is not reachable after line 3031, column 3

libpkg/pkg_printf.c:3083: error: MEMORY_LEAK
   memory dynamically allocated by call to sbuf_new() at line 3080,
column 41 is not reachable after line 3083, column 3

libpkg/pkg_repo.c:891: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
891, column 10 is not reachable after line 891, column 2

libpkg/pkg_repo_create.c:94: error: NULL_DEREFERENCE
   pointer new last assigned on line 93 could be null and is
dereferenced at line 94, column 2

libpkg/pkg_repo_create.c:303: error: MEMORY_LEAK
   memory dynamically allocated to b by call to sbuf_new() at line
299, column 2 is not reachable after line 303, column 3

libpkg/pkg_repo_create.c:310: error: MEMORY_LEAK
   memory dynamically allocated to b by call to sbuf_new() at line
299, column 2 is not reachable after line 310, column 4

libpkg/pkg_repo_create.c:319: error: MEMORY_LEAK
   memory dynamically allocated to b by call to sbuf_new() at line
299, column 2 is not reachable after line 319, column 3

libpkg/pkg_repo_create.c:327: error: MEMORY_LEAK
   memory dynamically allocated to b by call to sbuf_new() at line
299, column 2 is not reachable after line 327, column 2

libpkg/pkg_solve.c:1092: error: NULL_DEREFERENCE
   pointer nord last assigned on line 1091 could be null and is
dereferenced at line 1092, column 3

libpkg/pkgdb.c:872: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
872, column 10 is not reachable after line 872, column 2

libpkg/pkgdb.c:875: error: MEMORY_LEAK
   memory dynamically allocated to dbdir by call to
pkg_object_string() at line 872, column 10 is not reachable after line
875, column 3

libpkg/pkgdb.c:878: error: MEMORY_LEAK
   memory dynamically allocated to dbdir by call to
pkg_object_string() at line 872, column 10 is not reachable after line
878, column 3

libpkg/pkgdb.c:944: error: NULL_DEREFERENCE
   pointer r last assigned on line 943 could be null and is
dereferenced at line 944, column 38

libpkg/pkgdb.c:946: error: NULL_DEREFERENCE
   pointer r last assigned on line 943 could be null and is
dereferenced at line 946, column 8

libpkg/pkgdb.c:1988: error: NULL_DEREFERENCE
   pointer shlib last assigned on line 1987 could be null and is
dereferenced at line 1988, column 27

libpkg/pkgdb.c:2007: error: NULL_DEREFERENCE
   pointer cf last assigned on line 2006 could be null and is
dereferenced at line 2007, column 38

libpkg/pkgdb.c:2023: error: NULL_DEREFERENCE
   pointer shlib last assigned on line 2022 could be null and is
dereferenced at line 2023, column 27

libpkg/pkgdb.c:2042: error: NULL_DEREFERENCE
   pointer provide last assigned on line 2041 could be null and is
dereferenced at line 2042, column 27

libpkg/plugins.c:287: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
287, column 12 is not reachable after line 287, column 2

libpkg/repo/binary/fetch.c:39: error: MEMORY_LEAK
   memory dynamically allocated to cachedir by call to
pkg_object_string() at line 62, column 13 is not reachable after line
39, column 91

libpkg/repo/binary/fetch.c:62: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
62, column 13 is not reachable after line 62, column 2

libpkg/repo/binary/init.c:557: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
557, column 10 is not reachable after line 557, column 2

libpkg/repo/binary/query.c:480: error: MEMORY_LEAK
   memory dynamically allocated to sql by call to sbuf_new() at line
487, column 41 is not reachable after line 480, column 2

libpkg/rsa.c:304: error: NULL_DEREFERENCE
   pointer *rsa last assigned on line 303 could be null and is
dereferenced at line 304, column 2

libpkg/ssh.c:67: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
67, column 15 is not reachable after line 67, column 2

libpkg/utils.c:235: error: NULL_DEREFERENCE
   pointer buf last assigned on line 228 could be null and is
dereferenced by call to sbuf_putc() at line 235, column 4

libpkg/utils.c:381: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
381, column 11 is not reachable after line 381, column 2

libpkg/utils.c:382: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
382, column 18 is not reachable after line 382, column 2

src/annotate.c:181: error: NULL_DEREFERENCE
   pointer input last assigned on line 171 could be null and is
dereferenced by call to sbuf_putc() at line 181, column 3

src/audit.c:116: error: MEMORY_LEAK
   memory dynamically allocated to db_dir by call to
pkg_object_string() at line 135, column 11 is not reachable after line
116, column 73

src/audit.c:135: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
135, column 11 is not reachable after line 135, column 2

src/check.c:179: error: NULL_DEREFERENCE
   pointer pkgs last assigned on line 175 could be null and is
dereferenced at line 179, column 3

src/event.c:292: error: MEMORY_LEAK
   memory dynamically allocated by call to malloc() at line 283,
column 9 is not reachable after line 292, column 5

src/main.c:300: error: NULL_DEREFERENCE
   pointer p last assigned on line 299 could be null and is
dereferenced by call to pkg_plugin_conf() at line 300, column 10

src/ssh.c:68: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
68, column 15 is not reachable after line 68, column 2

src/ssh.c:73: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
68, column 15 is not reachable after line 73, column 3

src/ssh.c:92: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
68, column 15 is not reachable after line 92, column 19

src/version.c:234: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
234, column 14 is not reachable after line 234, column 2

src/version.c:261: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
261, column 13 is not reachable after line 261, column 2

src/version.c:263: error: MEMORY_LEAK
   memory dynamically allocated by call to pkg_object_string() at line
263, column 14 is not reachable after line 263, column 3

src/version.c:311: error: NULL_DEREFERENCE
   pointer version last assigned on line 310 could be null and is
dereferenced at line 311, column 3

src/version.c:656: error: NULL_DEREFERENCE
   pointer buf last assigned on line 655 could be null and is
dereferenced at line 656, column 2

- -- 
Vsevolod Stakhov
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCAAGBQJVelMJAAoJEAdke2eQCBQ3LHsP/1Tm/5NeNTPs0RceglcPoMc/
6cDMJyGEyFWdncdhExMSQd6lSo6mUoED4OfClY2/CIzYKSQo3fMAcdPvA7g3Yn2h
aWRmwrULG/us8iH87GAaZYUWhE+aicT2ZMXlHlWCvR3eQRSdPH6qHNlPnF1BA72C
aKvJ0xjaMcL0jrP8tN17exc+PhsQEL2CC7pvDE4V42AQiDyoPKpklo2LUUgNOQaJ
Z50fWhJ7vPCRfaXldT+Lvby99//rkFjrBBvkuZPWdPG4cgXbdaznr2oArMe+yaJ9
QzBZMZYPu4Cu/XpSRZhzqKtBMGEANGKa+eNlWO/CWNX7Tc4jlak7a5416Ly4PoaR
9UZ1QlPJHbp7L1erqkfo6nZ0YalO8bGk6QCWhdbcC8PaCCnFUpww/3pVVwQAHZ+v
ffyDx3wM/l81cKi5zMv7r0gzozQ6LT+52DnMkxiDvirXmfjwnOwRLP0NLWkXMEC2
1lcvjx3x1ueLUmiY5JHMI0pSPztcSw9B3304Zd+jqNQOjKjKgmqT59pYUNDPXEXk
3EwaGZG7TB2EdXi4oz/gT08b0e3QCzphJNWaHTf/RWDgf0Q5Q15tqeCKF4sG3ZHX
KAWLOZjjVNEXV4E4W7OztcvElnrzIioJzVaSA5qNJVJRt2XKzhsHQR2z/3ANEH3j
nO+rCmCc44IIeFUuoDF1
=Zkbc
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?557A5309.40304>