| Artifact ID: | 16a171693d6257edffb481748e70d5e1efd51c7a82cd126abaed835f6433a308 |
|---|---|
| Page Name: | checkin/54a4bc1458cafc03b9027835440615ca87e0f7220a4716f1c2111e84289dce08 |
| Date: | 2026-11-22 15:53:30 |
| Original User: | dmestas |
| Mimetype: | text/x-markdown |
Heap overflow in import --git
The git importer in src/import.c read the length of a data command with
atoi() and did not check it. A negative length gave a buffer of one byte and
an fread() of nearly all of memory into it, so a malformed stream overwrote
the heap with its own bytes. The largest int as a length overflowed the size
of the buffer. The input is a fast-import stream that a user is asked to
import.
The fix refuses a length that is not a number below 2147483647, as a bad
line. git fast-export never writes the other form of data that this also
refuses.
Tested with ASan and UBSan on macOS: the streams ASan stopped on before the fix
are now refused with no report, and the git dumps the tests import otherwise
give the same check-ins as before. The tests are in test/import.test, which
will come with the test-suite work. Not run on Linux or Windows.