Fix off-by-1 error in normalize_line_endings():
when *p == '\0' the NUL was copied into q and q was auto-incremented,
the loop was broken out of,
then a newline was appended followed by a NUL.
So the function, in effect, was strcpy() but added two extra chars
which was caught by obmalloc in debug mode, since there was only
room for 1 additional newline.
Get test working under regrtest (added test_main).
compression = ZIP_DEFLATED
-if __name__ == "__main__":
+def test_main():
test_support.run_unittest(UncompressedZipImportTestCase)
test_support.run_unittest(CompressedZipImportTestCase)
+
+if __name__ == "__main__":
+ test_main()
char *fullname;
enum module_info mi;
- if (!PyArg_ParseTuple(args, "s:zipimporter.find_module",
+ if (!PyArg_ParseTuple(args, "s:zipimporter.is_package",
&fullname))
return NULL;
return NULL;
}
/* replace "\r\n?" by "\n" */
- for (q = buf;;) {
+ for (q = buf; *p != '\0'; p++) {
if (*p == '\r') {
*q++ = '\n';
if (*(p + 1) == '\n')
}
else
*q++ = *p;
- if (*p == '\0')
- break;
- p++;
}
*q++ = '\n'; /* add trailing \n */
*q = '\0';