question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error while parsing: "should not reach here"

See original GitHub issue

~Snip stack:

    at Packet.readLengthCodedNumberExt (/node_modules/mysql2/lib/packets/packet.js:207:11)
    at Packet.readLengthCodedNumber (/node_modules/mysql2/lib/packets/packet.js:157:15)
    at Packet.parseLengthCodedInt (/node_modules/mysql2/lib/packets/packet.js:668:29)

I can’t tell exactly what the problem is, but it seems like there’s no bounds check on the Packet.readLengthCodedNumber function.

https://github.com/sidorares/node-mysql2/blob/b098d4969a000644d110e29b9aa0bee33cb1dfcb/lib/packets/packet.js#L152-L158

if offset is greater than buffer’s length, then byte2 is set to undefined, which breaks the rest of the code.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bradzachercommented, Oct 24, 2017

upon inspection - it seems like it occurs if you call one of the conversion functions (string/buffer/geometry) more than once for a field.

If you call one a second time then it essentially triggers the buffer read again without resetting the offset, which screws up the offset for future fields.

There should be handling in place this to prevent it (or an error message).

0reactions
hcd660commented, Aug 1, 2022

use mysql 5.7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reached end of file while parsing - Net-Informations.Com
The error Reached End of File While Parsing is a compiler error and almost always means that your curly parenthesis are not ending...
Read more >
Error while parsing — oracle-tech
Hi All When ever I execute the following programe I get an error public static final String CONFIG_FILE_NAME = "xyz.xml";
Read more >
Why do I get an error while parsing custom code ... - MathWorks
I am trying to run a simulink model in which some C caller blocks are used ( external custom c code). The Model...
Read more >
What is the "reached end of file while parsing" error, and how ...
You could avoid this error by fixing the syntax in the code causing the parser to expect additional closing syntax indicators (like a...
Read more >
CS 111: Common Java Errors - CS-People by full name
Since Foo does not match with Bar, the code will not compile. ... expected File: Test.java [line: 9] Error: Test.java:9: reached end of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found