diff mercurial/parsers.c @ 26872:ce03e72837c6 stable

parsers: fix width of datalen variable in fm1readmarkers Because parsers.c does not define PY_SSIZE_T_CLEAN, "s#" format requires (const char*, int), not (const char*, Py_ssize_t). https://docs.python.org/2/c-api/arg.html This error had no problem before 042344313939, where datalen wasn't used. But now fm1readmarkers() fails with "overflow in obsstore" on Python 2.6.9 (amd64) because upper bits of datalen seem to be filled with 1, making it a negative integer. This problem seems not visible on our Python 2.7 environment because upper bits happen to be filled with 0.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 07 Nov 2015 17:43:20 +0900
parents 3c259710737c
children f5e8cb813a4d
line wrap: on
line diff
--- a/mercurial/parsers.c	Fri Nov 06 11:08:11 2015 -0500
+++ b/mercurial/parsers.c	Sat Nov 07 17:43:20 2015 +0900
@@ -2692,7 +2692,7 @@
 
 static PyObject *fm1readmarkers(PyObject *self, PyObject *args) {
 	const char *data, *dataend;
-	Py_ssize_t datalen;
+	int datalen;
 	Py_ssize_t offset, stop;
 	PyObject *markers = NULL;