lecosson / assql

Automatically exported from code.google.com/p/assql
0 stars 0 forks source link

EOF check in handleNextPacket incorrect (per spec) #81

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Connect to 4.1.12-nt version of mysql
2. EOF header comes back with length (1)
3. Current code in QueryHandler::handleNextPacket checks for packet.length
== 5.
4. We miss the actual EOF.
5. For some reason my build of mysql is returning 1 byte EOF.

What is the expected output? What do you see instead?

We should detect EOF in all cases (not sure why my server is acting like
4.0 and not 4.1 but..).  Looking at the binary protocol spec for MySql
however, it's recommended you use the following pseudocode for detecting
EOF..not explicit length check ...  check for packet.length < 9.

e.g.

else if ( packet.length < 9 && (field_count == 0xFE || field_count == -2) )

This change works for me and all is well.

Original issue reported on code.google.com by corey.lu...@gmail.com on 2 Jun 2009 at 4:18

GoogleCodeExporter commented 9 years ago
this is a bug in mysql4.1. I file this bug.
http://bugs.mysql.com/bug.php?id=70211

some discuss in https://github.com/go-sql-driver/mysql/pull/114

Original comment by s7v7nisl...@gmail.com on 2 Sep 2013 at 7:22