Commit 586c7ae
committed
ROB: Accept inline image EI marker at the end of a content stream
When an inline image's EI marker was the very last token of a content
stream, with no trailing whitespace or operator, parsing raised
PdfReadError. Two places assumed a byte always follows EI: the caller
in _read_inline_image rejected an empty trailing byte (and the
unconditional one-byte rewind after reading the marker stepped back
into EI when only two bytes were available), and extract_inline_default
treated end-of-stream after EI as a failed match and kept reading.
An EI at end-of-stream is unambiguously the end of the image since no
binary data can follow, so accept it in both places (mirroring the
existing end-of-stream handling in _check_end_image_marker).1 parent 52545c5 commit 586c7ae
3 files changed
Lines changed: 32 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1429 | 1429 | | |
1430 | 1430 | | |
1431 | 1431 | | |
1432 | | - | |
1433 | | - | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
1434 | 1437 | | |
1435 | 1438 | | |
1436 | 1439 | | |
1437 | 1440 | | |
1438 | | - | |
1439 | | - | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
1440 | 1446 | | |
1441 | 1447 | | |
1442 | 1448 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
236 | 243 | | |
237 | 244 | | |
238 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1280 | 1280 | | |
1281 | 1281 | | |
1282 | 1282 | | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
1283 | 1298 | | |
1284 | 1299 | | |
1285 | 1300 | | |
| |||
0 commit comments