|Title:||Manifest parser bug causes fossil push to fail if a file look like a manifest but isn't one|
|Last Modified:||2010-10-16 16:25:17|
|Version Found In:||8f41b2fa75|
The bug can be reproduced with the following steps:
1. create an empty repository
2. clone it
3. open it
4. Create a text file containing "C blabla" and make sure it doesn't end with a newline character
5. commit it
6. Try to push it: it should fail with "bad command" followed by some stuff.
The bug is caused by the manifest parser which acts in a destructive way: when it parses a card, it uses blob_terminate which modifies the original buffer, even if it turns out afterwards that the file isn't actually a manifest (in my case it was just a small binary file which happened to begin with C and a tabulation character), which overwrite what's next (in this case it overwrites the first character of the following file card of the xfer stream, which confuses the xfer parser and make it end up trying to parse file content as cards).
I've attached a quick fix patch which simply make a copy of the line before parsing it. It works but it's probably possible to solve it without the additional copy.
drh added on 2010-10-16 16:25:17:
- manifest_parse_fix.diff [download] added by anonymous on 2010-10-16 10:49:32. [details]