Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Objects with JS Code: Error creating PDFStream: list indices must be integers or slices, not float #18

Closed
kandji-alex opened this issue Feb 21, 2024 · 10 comments

Comments

@kandji-alex
Copy link

kandji-alex commented Feb 21, 2024

I've been running this fork of the original peepdf project locally.

However, when I switch over to this repo, I'm getting different analysis results. Example:

peepdf -lf myfile.pdf
...
Version 0:
        Catalog: No
        Info: No
        Objects (488): [1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 51, 52, 53, 55, 56, 57, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 109, 111, 112, 113, 114, 116, 117, 118, 119, 121, 122, 123, 125, 126, 127, 129, 130, 131, 133, 134, 135, 137, 138, 139, 141, 142, 143, 145, 146, 147, 149, 150, 151, 153, 154, 155, 157, 158, 159, 161, 162, 163, 165, 166, 167, 169, 170, 171, 173, 174, 175, 177, 178, 179, 181, 182, 183, 185, 186, 187, 189, 190, 191, 193, 194, 195, 196, 198, 199, 200, 201, 202, 204, 207, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 442, 443, 445, 446, 447, 448, 449, 450, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 543, 544, 545, 546, 547, 548, 549, 551, 552, 553]
        Compressed objects (232): [1, 5, 10, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 116, 121, 125, 129, 133, 137, 141, 145, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 198, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 445, 446, 447, 448, 452, 453, 454, 455, 456, 457, 458, 459, 462, 468, 469, 471, 473, 475, 477, 478, 480, 482, 484, 486, 488, 490, 491, 493, 495, 497, 499, 501, 503, 504, 506, 508, 510, 512, 513, 515, 517, 519, 521, 522, 524, 526, 527, 529, 531, 533, 535, 537, 543, 544, 546, 548]
                Errors (5): [200, 202, 461, 463, 464]
        Streams (151): [2, 3, 6, 7, 8, 11, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29, 32, 33, 36, 37, 40, 41, 44, 45, 48, 49, 52, 53, 56, 57, 60, 61, 64, 65, 68, 69, 72, 73, 76, 77, 80, 81, 84, 85, 88, 89, 92, 93, 96, 97, 100, 101, 104, 105, 108, 109, 112, 113, 114, 117, 118, 119, 122, 123, 126, 127, 130, 131, 134, 135, 138, 139, 142, 143, 146, 147, 150, 151, 154, 155, 158, 159, 162, 163, 166, 167, 170, 171, 174, 175, 178, 179, 182, 183, 186, 187, 190, 191, 194, 195, 196, 199, 200, 201, 202, 204, 207, 442, 443, 460, 461, 463, 464, 470, 472, 474, 476, 479, 481, 483, 485, 487, 489, 492, 494, 496, 498, 500, 502, 505, 507, 509, 511, 514, 516, 518, 520, 523, 525, 528, 530, 532, 534, 536, 538, 545, 547, 549, 551, 552, 553]
                Object streams (3): [551, 552, 553]
                Encoded (130): [2, 3, 6, 7, 8, 11, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29, 32, 33, 36, 37, 40, 41, 44, 45, 48, 49, 52, 53, 56, 57, 60, 61, 64, 65, 68, 69, 72, 73, 76, 77, 80, 81, 84, 85, 88, 89, 92, 93, 96, 97, 100, 101, 104, 105, 108, 109, 112, 113, 114, 117, 118, 119, 122, 123, 126, 127, 130, 131, 134, 135, 138, 139, 142, 143, 146, 147, 150, 151, 154, 155, 158, 159, 162, 163, 166, 167, 170, 171, 174, 175, 178, 179, 182, 183, 186, 187, 190, 191, 194, 195, 196, 199, 200, 201, 202, 204, 442, 443, 460, 461, 463, 464, 470, 474, 479, 483, 492, 496, 500, 505, 509, 514, 523, 528, 532, 536, 545, 551, 552, 553]
                Decoding errors (5): [200, 202, 461, 463, 464]
        Objects with JS code (23): [6, 20, 36, 40, 44, 52, 68, 76, 80, 92, 104, 108, 112, 142, 146, 154, 158, 166, 170, 174, 186, 194, 199]

This is correct and expected.

However, switching to this repo, the following code, even with force mode on, gets stuck on an error and never reports Objects with JS Code. It does report Objects, CompressedObjects, Streams, and other data successfully.

from peepdf.PDFCore import PDFParser


fileName = "myfile.pdf"
pdfParser = PDFParser()
ret, pdf = pdfParser.parse(fileName, True, True, False)
statsDict = pdf.getStats()
print(statsDict)

I get this instead:

    "[!] Error parsing object: 550 0 obj ([!] Error creating PDFStream: list indices must be integers or slices, not float)"
  ],
  ...
'Objects with JS code': None
@digitalsleuth
Copy link
Owner

Hi @kandji-alex , are you able to provide the pdf file you used so I can identify the source of the issue?

@digitalsleuth
Copy link
Owner

digitalsleuth commented Feb 22, 2024 via email

@digitalsleuth
Copy link
Owner

Ahhh, email address didn't show up! Sorry about that, you can send it to github at digitalsleuth dot ca

@kandji-alex
Copy link
Author

I thought you were just trolling me XD

@kandji-alex
Copy link
Author

Sent.

@digitalsleuth
Copy link
Owner

Hi @kandji-alex , just wanted to give you a heads up that I haven't forgotten about this, and am working on it when I have some time to dedicate to this. I'll let you know as soon as I have some info!

@kandji-alex
Copy link
Author

Awesome! And yeah I sent another email but, I have interest in peepdf being maintained and easily accessible via pypi. So I'd be happy to work any issues or contribute if you need another set of eyes, a review, whatever.

@digitalsleuth
Copy link
Owner

Hi @kandji-alex This issue has been identified and has been resolved in the next upcoming release. I'm currently doing some linting and will be releasing this in the next 24 hours. Thanks for keeping an eye out for issues!

Cheers!

@digitalsleuth
Copy link
Owner

Hi @kandji-alex , this has been fixed in the latest release, v4.0.0.

Cheers!

@digitalsleuth
Copy link
Owner

Haven't received any updates on this. If the issue still exists, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants