summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-10-28 21:36:37 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-10-28 21:36:37 (GMT)
commitb5fdf0da2151527b9f7625e41ac40cfdceb0f8f3 (patch)
tree1f2a7f090896e0ac4fffbf4793e22fa126dee9e7 /Python
parentaabdd5480c23120eae18cdf1c45ae71814ac2eb9 (diff)
downloadcpython-b5fdf0da2151527b9f7625e41ac40cfdceb0f8f3.zip
cpython-b5fdf0da2151527b9f7625e41ac40cfdceb0f8f3.tar.gz
cpython-b5fdf0da2151527b9f7625e41ac40cfdceb0f8f3.tar.bz2
Backport 52501:
Add some asserts. In sysmodule, I think these were to try to silence some warnings from Klokwork. They verify the assumptions of the format of svn version output. The assert in the thread module helped debug a problem on HP-UX.
Diffstat (limited to 'Python')
-rw-r--r--Python/sysmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 6fbaba50..4970adf 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -983,6 +983,8 @@ svnversion_init(void)
br_start = python + 8;
br_end = strchr(br_start, '/');
+ assert(br_end);
+
/* Works even for trunk,
as we are in trunk/Python/sysmodule.c */
br_end2 = strchr(br_end+1, '/');
@@ -995,6 +997,8 @@ svnversion_init(void)
}
else if (istag || strncmp(br_start, "branches", 8) == 0) {
len = br_end2 - br_start;
+ assert(len >= 13);
+ assert(len < (sizeof(patchlevel_revision) - 13));
strncpy(branch, br_start, len);
branch[len] = '\0';