PowerDNS / lmdb-go

Bindings for the LMDB C library
BSD 3-Clause "New" or "Revised" License
13 stars 7 forks source link

Warnings on build #18

Closed shane-ns1 closed 1 year ago

shane-ns1 commented 1 year ago

We're seeing warnings on the build:

mdb.c: In function 'mdb_env_cwalk':
mdb.c:9273:7: warning: writing 8 bytes into a region of size 1 [-Wstringop-overflow=]
 9273 |       memcpy(NODEDATA(ni), &my->mc_next_pgno, sizeof(pgno_t));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mdb.c:941:8: note: at offset 0 to object 'mn_data' with size 1 declared here
  941 |  char  mn_data[1];   /**< key and data are appended here */
      |        ^~~~~~~
mdb.c: In function 'mdb_node_add':
mdb.c:7412:4: warning: writing 8 bytes into a region of size 1 [-Wstringop-overflow=]
 7412 |    memcpy(ndata, &ofp->mp_pgno, sizeof(pgno_t));
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mdb.c:7406:5: warning: writing 8 bytes into a region of size 1 [-Wstringop-overflow=]
 7406 |     memcpy(ndata, data->mv_data, sizeof(pgno_t));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since our Go version trusts our C coders to have figured out stuff like this, we can just ignore these (a quick inspection reveals that they are almost certainly false positives). PR incoming.