commit a36e3c039fb1cd09ddd1729531b1cf9fb99924ab from: Antoine Lambert via: GitHub date: Tue Oct 03 12:42:12 2023 UTC _pack: Fix some big left-shifts of unsigned char (#1223) Apply same fix as in https://github.com/git/git/commit/48fb7de commit - b429680214ae2d783b8083bd77fcfba47b00f193 commit + a36e3c039fb1cd09ddd1729531b1cf9fb99924ab blob - 3ee9828d0bf570a34baefeaa7638890f5322786f blob + ecfc49c297e37c7e070330ec16f6cdf10dbe0449 --- dulwich/_pack.c +++ dulwich/_pack.c @@ -41,7 +41,7 @@ static size_t get_delta_header_size(uint8_t *delta, si size_t size = 0; size_t i = 0; while ((*index) < length) { - uint8_t cmd = delta[*index]; + size_t cmd = delta[*index]; (*index)++; size |= (cmd & ~0x80) << i; i += 7; @@ -130,14 +130,14 @@ static PyObject *py_apply_delta(PyObject *self, PyObje int i; for (i = 0; i < 4; i++) { if (cmd & (1 << i)) { - uint8_t x = delta[index]; + unsigned x = delta[index]; index++; cp_off |= x << (i * 8); } } for (i = 0; i < 3; i++) { if (cmd & (1 << (4+i))) { - uint8_t x = delta[index]; + unsigned x = delta[index]; index++; cp_size |= x << (i * 8); }