Connection.recv:buf size bug

Bug #551533 reported by seewind
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.

Related branches

Changed in myconnpy:
assignee: nobody → Geert JM Vanderkelen (geertjmvdk)
Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

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
Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

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
Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

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
Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.