I would like to report some issues in python basemap package and easy-fixes for
some of them. We would really appreciate if there was somebody who could look
on this and consider important bugs to be fixed.
These bugs was found by Coverity scan and we have ran it on Fedora 15
packages (srpm). There was some findings in python basemap package also. Coverity
is proprietary software but we can give its result to community (if interrested),
possibly we can re-run some tests on srpms on demand.
Patch for next three obvious bugs (plaintext cov. output) is attached:
basemap-0.99.4/src/pj_gridlist.c:252: overrun-local: Overrunning static array "name", with 128 elements, at position 128 with index variable "end_char".
basemap-0.99.4/src/mk_cheby.c:42: var_decl: Declaring variable "T" without initializer.
basemap-0.99.4/src/mk_cheby.c:150: uninit_use: Using uninitialized value "T".
basemap-0.99.4/src/mk_cheby.c:151: uninit_use: Using uninitialized value "T->mu".
basemap-0.99.4/src/mk_cheby.c:152: uninit_use: Using uninitialized value "T->cu".
basemap-0.99.4/src/mk_cheby.c:154: uninit_use: Using uninitialized value "T->mv".
basemap-0.99.4/src/mk_cheby.c:155: uninit_use: Using uninitialized value "T->cv".
basemap-0.99.4/src/mk_cheby.c:163: uninit_use: Using uninitialized value "T".
basemap-0.99.4/src/PJ_sconics.c:52: self_assign: Assignment operation "*del = *del" has no effect.
CoverityScan-defects.patch (1.13 KB)
But there is more defects (or coding style issues) and some of them are not
so obvious. There could be potential problems -- need to be consulted, e.g.:
basemap-0.99.4/src/PJ_stere.c:232: write_write_order: In "P->phits = (pj_param(P->params, "tlat_ts").i ? P->phits = pj_param(P->params, "rlat_ts").f : 1.5708)", "P->phits" is written in "P->phits" (the assignment left-hand side) and written in "pj_param(P->params, "tlat_ts").i ? P->phits = pj_param(P->params, "rlat_ts").f : 1.5708" but the order in which the side effects take place is undefined because there is no intervening sequence point.
basemap-0.99.4/src/emess.c:29: var_compare_op: Comparing "fmt" to null implies that "fmt" might be null.
basemap-0.99.4/src/emess.c:51: var_deref_model: Passing null variable "fmt" to function "vfprintf", which dereferences it.
basemap-0.99.4/src/pj_gridinfo.c:505: var_compare_op: Comparing "gp" to null implies that "gp" might be null.
basemap-0.99.4/src/pj_gridinfo.c:512: alias_transfer: Assigning null: "lnk" = "gp".
basemap-0.99.4/src/pj_gridinfo.c:512: var_deref_op: Dereferencing null variable "lnk".
basemap-0.99.4/src/pj_ell_set.c:30: var_compare_op: Comparing "start->next" to null implies that "start->next" might be null.
basemap-0.99.4/src/pj_ell_set.c:92: var_deref_op: Dereferencing null variable "start->next".
Coverity test was done on:
..so svn version is little different (line numbers) but it can be handy for
finding hidden bugs. I can send you full plain-text log if you want.