##// END OF EJS Templates
manifest: fix possible SEGV caused by uninitialized lazymanifest fields...
Yuya Nishihara -
r38346:ae7f2786 stable
parent child Browse files
Show More
@@ -135,12 +135,22 b' static int find_lines(lazymanifest *self'
135 135 return 0;
136 136 }
137 137
138 static void lazymanifest_init_early(lazymanifest *self)
139 {
140 self->pydata = NULL;
141 self->lines = NULL;
142 self->numlines = 0;
143 self->maxlines = 0;
144 }
145
138 146 static int lazymanifest_init(lazymanifest *self, PyObject *args)
139 147 {
140 148 char *data;
141 149 Py_ssize_t len;
142 150 int err, ret;
143 151 PyObject *pydata;
152
153 lazymanifest_init_early(self);
144 154 if (!PyArg_ParseTuple(args, "S", &pydata)) {
145 155 return -1;
146 156 }
@@ -668,6 +678,7 b' static lazymanifest *lazymanifest_copy(l'
668 678 if (!copy) {
669 679 goto nomem;
670 680 }
681 lazymanifest_init_early(copy);
671 682 copy->numlines = self->numlines;
672 683 copy->livelines = self->livelines;
673 684 copy->dirty = false;
@@ -705,6 +716,7 b' static lazymanifest *lazymanifest_filter'
705 716 if (!copy) {
706 717 goto nomem;
707 718 }
719 lazymanifest_init_early(copy);
708 720 copy->dirty = true;
709 721 copy->lines = malloc(self->maxlines * sizeof(line));
710 722 if (!copy->lines) {
General Comments 0
You need to be logged in to leave comments. Login now