MySQL Connector/Python

Connection.recv:buf size bug

Reported by seewind on 2010-03-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Connector/Python
Fix Released
Critical
Geert JM Vanderkelen
0.1
Fix Released
Critical
Geert JM Vanderkelen

Bug Description

sorry about my poor english.

the patch is:
=== (+24,-23) mysql/connector/connection.py ===
@@ -92,21 +92,22 @@
                 if pktnr == -1 and totalsize > 4:
                     pktsize = utils.intread(buf[0:3])
                     pktnr = utils.intread(buf[3])
- if pktnr > -1 and totalsize >= pktsize:
+ if pktnr > -1 and totalsize >= pktsize+4:
                     size = pktsize+4
+ #print '[mysql]recv:', size, pktnr, repr(buf)
                     self.buffer.append(buf[0:size])
                     buf = buf[size:]
                     pktnr = -1
                     if len(buf) == 0:
                         break
- elif len(buf) < pktsize:
+ elif len(buf) < pktsize+4:
                     buf += self.sock.recv(self.recvsize, self.socket_flags)

because size = pktsize+4, if totalsize >= pktsize and totalsize < pktsize+4, this bug is appear.

Changed in myconnpy:
assignee: nobody → Geert JM Vanderkelen (geertjmvdk)

Thanks for this bug report and patch.
I'm not able to find a good case to reproduce problems. Do you have away to cause problems without patching this code?

Changed in myconnpy:
status: New → Incomplete

Got a test case with bug report #586003!

Thanks for this bug report, now I can repeat it.

Changed in myconnpy:
importance: Undecided → Critical
status: Incomplete → In Progress

revno: 240
committer: Geert Vanderkelen <email address hidden>
branch nick: myconnpy-bug-lp586003
timestamp: Thu 2010-05-27 11:05:59 +0200
message:
  Critical bug fix: impossible to select big results

  o It was impossible to select big result sets.
  o Fixed for both Python2 and Python3.
  o Added test case for bug lp:586003 and lp:551533

Changed in myconnpy:
status: In Progress → Fix Committed
Changed in myconnpy:
status: Fix Committed → Fix Released
status: Fix Released → In Progress

Merged into trunk rev248

Changed in myconnpy:
status: In Progress → Fix Committed
Changed in myconnpy:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers