diff options
author | Bram Moolenaar <bram@vim.org> | 2015-02-10 18:41:58 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2015-02-10 18:41:58 +0100 |
commit | 4aafc2dcd19df3667280c047dbf108e843ecef6f (patch) | |
tree | 6a11beb0f5257ca531094dbfa6a00ec737a04096 | |
parent | f39ca2f952dfc8dbddd93247129d548b8a14d269 (diff) | |
download | vim-4aafc2dcd19df3667280c047dbf108e843ecef6f.tar.gz |
Problem: Possible NULL pointer dereference.
Solution: Check for NULL before using it. (Mike Williams)
-rw-r--r-- | src/if_py_both.h | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index a46b42ad..497db866 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -747,12 +747,14 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) else if (our_tv->v_type == VAR_DICT) { - hashtab_T *ht = &our_tv->vval.v_dict->dv_hashtab; - long_u todo = ht->ht_used; + hashtab_T *ht; + long_u todo; hashitem_T *hi; dictitem_T *di; + if (our_tv->vval.v_dict == NULL) return NULL; + ht = &our_tv->vval.v_dict->dv_hashtab; if (!(ret = PyDict_New())) return NULL; @@ -763,6 +765,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) return NULL; } + todo = ht->ht_used; for (hi = ht->ht_array; todo > 0; ++hi) { if (!HASHITEM_EMPTY(hi)) diff --git a/src/version.c b/src/version.c index 70a8633d..c14eac35 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 625, +/**/ 624, /**/ 623, |