Bug #37522 Backup: stream_v1_transport: Error condition should be checked for as_* calls
Submitted: 19 Jun 2008 12:07 Modified: 29 Sep 2008 20:50
Reporter: Øystein Grøvlen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0 OS:Any
Assigned to: Rafal Somla CPU Architecture:Any

[19 Jun 2008 12:07] Øystein Grøvlen
Description:
sql/backup/stream_v1_transport.c contains the following macros:

#define as_write(S,Data,Env) \
  ((S)->write ? (S)->write((S),(Data),(Env)) : BSTREAM_ERROR)

#define as_read(S,Buf,Env) \
  ((S)->read ?(S)->read((S),(Buf),(Env)) : BSTREAM_ERROR)

#define as_forward(S,Off) \
  ((S)->forward ? (S)->forward((S),(Off)) : (*(Off)=0, BSTREAM_ERROR))

Currently, not all calls to these macros detects BSTREAM_ERROR.  One should make sure to either test for this or to make sure the return value is propagated to the caller.

How to repeat:
Code inspection
[19 Jun 2008 13:54] Susanne Ebrecht
Verified as described.

sql/backup/stream_v1_transport.c

line 274 and following lines at bzr tree for MySQL 6.0 from today.
[4 Sep 2008 9:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/53234

2691 Rafal Somla	2008-09-04
      BUG#37522 (Backup: stream_v1_transport: Error condition should be checked for as_* calls)
      
      This patch adds checks for errors in stream_v1_transport.c where the low level I/O 
      functions are called.
[8 Sep 2008 12:57] Jørgen Løland
Good to push.
[10 Sep 2008 18:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/53727

2691 Rafal Somla	2008-09-10
      BUG#37522 (Backup: stream_v1_transport: Error condition should be checked for as_*calls)
            
      This patch adds checks for errors in stream_v1_transport.c where the low level I/O 
      functions are called.
[11 Sep 2008 9:17] Øystein Grøvlen
Good to push, but I expect you will add some comments as discussed.
[11 Sep 2008 9:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/53805

2691 Rafal Somla	2008-09-11
      BUG#37522 (Backup: stream_v1_transport: Error condition should be checked for as_* calls)
            
      This patch adds checks for errors in stream_v1_transport.c where the low level I/O 
      functions are called.
[11 Sep 2008 14:11] Rafal Somla
Pushed into mysql-6.0-backup tree.
[28 Sep 2008 19:22] Øystein Grøvlen
Pushed to 6.0 main for 6.0.8
[29 Sep 2008 20:50] Paul DuBois
Noted in 6.0.8 changelog.

MySQL Backup was not consistently checking for BSTREAM_ERROR errors.