[Python-checkins] cpython (2.7): add missing NULL checks to get_coding_spec (closes #24854)

benjamin.peterson python-checkins at python.org
Fri Aug 14 06:53:12 CEST 2015


https://hg.python.org/cpython/rev/208d6d14c2a3
changeset:   97376:208d6d14c2a3
branch:      2.7
parent:      97365:d9c85b6bab3a
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Aug 13 21:52:56 2015 -0700
summary:
  add missing NULL checks to get_coding_spec (closes #24854)

files:
  Parser/tokenizer.c |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -235,7 +235,10 @@
 
             if (begin < t) {
                 char* r = new_string(begin, t - begin);
-                char* q = get_normal_name(r);
+                char* q;
+                if (!r)
+                    return NULL;
+                q = get_normal_name(r);
                 if (r != q) {
                     PyMem_FREE(r);
                     r = new_string(q, strlen(q));

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list