Mercurial > hg
comparison mercurial/parsers.c @ 26052:b970418bbafe
parsers: set exception when there's too little string data to extract parents
Previously we were returning NULL from this function without actually
setting up an exception. This fixes that problem, which was detected
with cpychecker.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 18 Aug 2015 16:40:10 -0400 |
parents | af090796cb33 |
children | b68c9d232db6 |
comparison
equal
deleted
inserted
replaced
26051:af090796cb33 | 26052:b970418bbafe |
---|---|
479 goto quit; | 479 goto quit; |
480 | 480 |
481 len = readlen; | 481 len = readlen; |
482 | 482 |
483 /* read parents */ | 483 /* read parents */ |
484 if (len < 40) | 484 if (len < 40) { |
485 PyErr_SetString( | |
486 PyExc_ValueError, "too little data for parents"); | |
485 goto quit; | 487 goto quit; |
488 } | |
486 | 489 |
487 parents = Py_BuildValue("s#s#", str, 20, str + 20, 20); | 490 parents = Py_BuildValue("s#s#", str, 20, str + 20, 20); |
488 if (!parents) | 491 if (!parents) |
489 goto quit; | 492 goto quit; |
490 | 493 |