Fossil SCM

checkin/54a4bc1458cafc03b9027835440615ca87e0f7220a4716f1c2111e84289dce08

5 days, 14 hours ago by dmestas

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.

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button