Show More
@@ -109,7 +109,7 b' b85decode(PyObject *self, PyObject *args' | |||
|
109 | 109 | if (c < 0) |
|
110 | 110 | return PyErr_Format( |
|
111 | 111 | PyExc_ValueError, |
|
112 |
" |
|
|
112 | "bad base85 character at position %d", i); | |
|
113 | 113 | acc = acc * 85 + c; |
|
114 | 114 | } |
|
115 | 115 | if (i++ < len) |
@@ -118,13 +118,13 b' b85decode(PyObject *self, PyObject *args' | |||
|
118 | 118 | if (c < 0) |
|
119 | 119 | return PyErr_Format( |
|
120 | 120 | PyExc_ValueError, |
|
121 |
" |
|
|
121 | "bad base85 character at position %d", i); | |
|
122 | 122 | /* overflow detection: 0xffffffff == "|NsC0", |
|
123 | 123 | * "|NsC" == 0x03030303 */ |
|
124 | 124 | if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c) |
|
125 | 125 | return PyErr_Format( |
|
126 | 126 | PyExc_ValueError, |
|
127 |
" |
|
|
127 | "bad base85 sequence at position %d", i); | |
|
128 | 128 | acc += c; |
|
129 | 129 | } |
|
130 | 130 |
@@ -1051,7 +1051,11 b' class binhunk(object):' | |||
|
1051 | 1051 | l = ord(l) - ord('A') + 1 |
|
1052 | 1052 | else: |
|
1053 | 1053 | l = ord(l) - ord('a') + 27 |
|
1054 | try: | |
|
1054 | 1055 | dec.append(base85.b85decode(line[1:-1])[:l]) |
|
1056 | except ValueError, e: | |
|
1057 | raise PatchError(_('could not decode binary patch: %s') | |
|
1058 | % str(e)) | |
|
1055 | 1059 | line = lr.readline() |
|
1056 | 1060 | self.hunk.append(line) |
|
1057 | 1061 | text = zlib.decompress(''.join(dec)) |
@@ -362,6 +362,25 b' Move text file and patch as binary' | |||
|
362 | 362 | A binary2 |
|
363 | 363 | text2 |
|
364 | 364 | R text2 |
|
365 | ||
|
366 | Invalid base85 content | |
|
367 | $ hg rollback | |
|
368 | repository tip rolled back to revision 15 (undo import) | |
|
369 | working directory now based on revision 15 | |
|
370 | $ hg revert -aq | |
|
371 | $ hg import -d "1000000 0" -m invalid-binary - <<"EOF" | |
|
372 | > diff --git a/text2 b/binary2 | |
|
373 | > rename from text2 | |
|
374 | > rename to binary2 | |
|
375 | > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 | |
|
376 | > GIT binary patch | |
|
377 | > literal 5 | |
|
378 | > Mc$`b*O.$Pw00T?_*Z=?k | |
|
379 | > | |
|
380 | > EOF | |
|
381 | applying patch from stdin | |
|
382 | abort: could not decode binary patch: bad base85 character at position 6 | |
|
383 | [255] | |
|
365 | 384 | $ cd .. |
|
366 | 385 | |
|
367 | 386 | Consecutive import with renames (issue2459) |
General Comments 0
You need to be logged in to leave comments.
Login now