[haiku-commits] haiku: hrev47502 - in src: bin kits/interface apps/patchbay kits/network/libbind/resolv

  • From: stpere@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 15 Jul 2014 23:06:27 +0200 (CEST)

hrev47502 adds 4 changesets to branch 'master'
old head: 37b6c4337ca6df12a4902e7e5b3a541d2c89de61
new head: 62f70e6f0ad0f5896250903736e47183facf6077
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=62f70e6+%5E37b6c43

----------------------------------------------------------------------------

d32cb23: Fix Coverity bug 603941: Negative array index read
  
  Signed-off-by: Philippe Saint-Pierre <stpere@xxxxxxxxx>

                                      [ Puck Meerburg <puck@xxxxxxxxxxxxx> ]

eda1d21: CID 991761: potential double close (and white space fix)

                                [ Philippe Saint-Pierre <stpere@xxxxxxxxx> ]

c4f80d1: CID 1108469: Use after free

                                [ Philippe Saint-Pierre <stpere@xxxxxxxxx> ]

62f70e6: Fix Coverity bug 1108392: Stray semicolon
  
  Signed-off-by: Philippe Saint-Pierre <stpere@xxxxxxxxx>

                                      [ Puck Meerburg <puck@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 20 insertions(+), 18 deletions(-)
src/apps/patchbay/EndpointInfo.cpp          |  7 ++++---
src/bin/chop.c                              | 27 +++++++++++++------------
src/kits/interface/ColumnListView.cpp       |  2 +-
src/kits/network/libbind/resolv/res_query.c |  2 +-

############################################################################

Commit:      d32cb23734f850b5676d4e6a46b406001709a08a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d32cb23
Author:      Puck Meerburg <puck@xxxxxxxxxxxxx>
Date:        Mon Dec 23 23:32:52 2013 UTC
Committer:   Philippe Saint-Pierre <stpere@xxxxxxxxx>
Commit-Date: Tue Jul 15 19:14:56 2014 UTC

Fix Coverity bug 603941: Negative array index read

Signed-off-by: Philippe Saint-Pierre <stpere@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/kits/network/libbind/resolv/res_query.c 
b/src/kits/network/libbind/resolv/res_query.c
index e46d6f1..a8ec89c 100644
--- a/src/kits/network/libbind/resolv/res_query.c
+++ b/src/kits/network/libbind/resolv/res_query.c
@@ -135,8 +135,8 @@ again:
        if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 &&
            (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) {
                n = res_nopt(statp, n, buf, sizeof(buf), anslen);
-               rdata = &buf[n];
                if (n > 0 && (statp->options & RES_NSID) != 0U) {
+                       rdata = &buf[n];
                        n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata,
                                           NS_OPT_NSID, 0, NULL);
                }

############################################################################

Commit:      eda1d21fde1e6e1c451bc96ace0610f822111981
URL:         http://cgit.haiku-os.org/haiku/commit/?id=eda1d21
Author:      Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date:        Tue Jul 15 19:34:36 2014 UTC

CID 991761: potential double close (and white space fix)

----------------------------------------------------------------------------

diff --git a/src/bin/chop.c b/src/bin/chop.c
index bcde16b..964307a 100644
--- a/src/bin/chop.c
+++ b/src/bin/chop.c
@@ -178,7 +178,7 @@ void
 chop_file(int fdin, char *fname, off_t fsize)
 {
        const off_t chunk_size = KBytesPerChunk * 1024;  // max bytes written 
to any output file
-       
+
        bool open_next_file = true;  // when to open a new output file
        char fnameN[256];            // name of the current output file 
(file01, file02, etc.)
        int  index = 0;              // used to generate the next output file 
name
@@ -190,27 +190,27 @@ chop_file(int fdin, char *fname, off_t fsize)
        ssize_t avail;               // how many bytes we can safely grab from 
the current data block
        off_t   curr_written = 0;    // number of bytes written to the current 
output file
        off_t   total_written = 0;   // total bytes written out to all output 
files
-               
+
        char *beg = Block;  // pointer to the beginning of the block data to be 
written out
        char *end = Block;  // end of the current block (init to beginning to 
force first block read)
-       
+
        printf("Chopping up %s into %d kbyte chunks\n", fname, KBytesPerChunk);
-       
+
        while (total_written < fsize) {
                if (beg >= end) {
                        // read in another block
                        got = read(fdin, Block, BLOCKSIZE);
                        if (got <= 0)
                                break;
-                       
+
                        beg = Block;
                        end = Block + got - 1;
                }
-               
+
                if (open_next_file) {
                        // start a new output file
                        sprintf(fnameN,  "%s%02d", fname, index++);
-                       
+
                        fdout = open(fnameN, O_WRONLY|O_CREAT);
                        if (fdout < 0) {
                                fprintf(stderr, "unable to create chunk file 
'%s': %s\n", fnameN, strerror(errno));
@@ -219,7 +219,7 @@ chop_file(int fdin, char *fname, off_t fsize)
                        curr_written = 0;
                        open_next_file = false;
                }
-               
+
                needed = chunk_size - curr_written;
                avail  = end - beg + 1;
                if (needed > avail)
@@ -228,18 +228,19 @@ chop_file(int fdin, char *fname, off_t fsize)
                if (needed > 0) {
                        put = write(fdout, beg, needed);
                        beg += put;
-                       
+
                        curr_written  += put;
                        total_written += put;
                }
-               
+
                if (curr_written >= chunk_size) {
                        // the current output file is full
                        close(fdout);
                        open_next_file = true;
                }
        }
-       
-       // close up the last output file
-       close(fdout);
+
+       // close up the last output file if it's still open
+       if (!open_next_file)
+               close(fdout);
 }

############################################################################

Commit:      c4f80d1ee89538565743229ceca9b7ec933dda19
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c4f80d1
Author:      Philippe Saint-Pierre <stpere@xxxxxxxxx>
Date:        Tue Jul 15 20:11:51 2014 UTC

CID 1108469: Use after free

----------------------------------------------------------------------------

diff --git a/src/apps/patchbay/EndpointInfo.cpp 
b/src/apps/patchbay/EndpointInfo.cpp
index 538061a..4dd14da 100644
--- a/src/apps/patchbay/EndpointInfo.cpp
+++ b/src/apps/patchbay/EndpointInfo.cpp
@@ -111,8 +111,10 @@ CreateIcon(const BMessage* msg, icon_size which)
                        bitmap) == B_OK) {
                        printf("Created vector icon bitmap\n");
                        return bitmap;
-               } else
+               } else {
                        delete bitmap;
+                       bitmap = NULL;
+               }
        }
 
        // If not, look for BeOS style icon
@@ -128,9 +130,8 @@ CreateIcon(const BMessage* msg, icon_size which)
                bmapSize = MINI_ICON_SIZE - 1;
                iconType = MINI_ICON_TYPE;
                iconName = MINI_ICON_NAME;
-       } else {
+       } else
                return NULL;
-       }
 
        if (msg->FindData(iconName, iconType, &data, &size) == B_OK) {
                bitmap = new BBitmap(BRect(0, 0, bmapSize, bmapSize),

############################################################################

Revision:    hrev47502
Commit:      62f70e6f0ad0f5896250903736e47183facf6077
URL:         http://cgit.haiku-os.org/haiku/commit/?id=62f70e6
Author:      Puck Meerburg <puck@xxxxxxxxxxxxx>
Date:        Mon Dec 23 23:14:48 2013 UTC
Committer:   Philippe Saint-Pierre <stpere@xxxxxxxxx>
Commit-Date: Tue Jul 15 20:17:46 2014 UTC

Fix Coverity bug 1108392: Stray semicolon

Signed-off-by: Philippe Saint-Pierre <stpere@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/kits/interface/ColumnListView.cpp 
b/src/kits/interface/ColumnListView.cpp
index e5a8532..b05d496 100644
--- a/src/kits/interface/ColumnListView.cpp
+++ b/src/kits/interface/ColumnListView.cpp
@@ -2004,7 +2004,7 @@ BColumnListView::DoLayout()
 
        if (fStatusView != NULL) {
                BSize size = fStatusView->MinSize();
-               if (size.height > B_H_SCROLL_BAR_HEIGHT);
+               if (size.height > B_H_SCROLL_BAR_HEIGHT)
                        size.height = B_H_SCROLL_BAR_HEIGHT;
                if (size.width > Bounds().Width() / 2)
                        size.width = floorf(Bounds().Width() / 2);


Other related posts:

  • » [haiku-commits] haiku: hrev47502 - in src: bin kits/interface apps/patchbay kits/network/libbind/resolv - stpere