Skip to content

Commit

Permalink
Fix infinite loop if blockette chain is corrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Trabant committed Mar 11, 2015
1 parent e60ab64 commit eff4d57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2015.070: 2.15
- Fix infinite loop if blockette chain is corrupt. Patch submitted
by Elliott Sales de Andrade.

2015.062: 2.14
- Fix memory leak when msr_pack() returns after an error. Patch
contributed by Larry Baker and Eric Thomas.
Expand Down
4 changes: 2 additions & 2 deletions libmseed.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ extern "C" {

#include "lmplatform.h"

#define LIBMSEED_VERSION "2.14"
#define LIBMSEED_RELEASE "2015.062"
#define LIBMSEED_VERSION "2.15"
#define LIBMSEED_RELEASE "2015.070"

#define MINRECLEN 128 /* Minimum Mini-SEED record length, 2^7 bytes */
/* Note: the SEED specification minimum is 256 */
Expand Down
10 changes: 5 additions & 5 deletions parseutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Written by Chad Trabant
* IRIS Data Management Center
*
* modified: 2014.248
* modified: 2015.070
***************************************************************************/

#include <stdio.h>
Expand Down Expand Up @@ -284,14 +284,14 @@ ms_detect ( const char *record, int recbuflen )

/* Calculate record size in bytes as 2^(blkt_1000->reclen) */
reclen = (unsigned int) 1 << blkt_1000->reclen;
break;
}

/* Saftey check for invalid offset */
if ( next_blkt != 0 && next_blkt < blkt_offset )
/* Safety check for invalid offset */
if ( next_blkt != 0 && ( next_blkt < 4 || (next_blkt - 4) <= blkt_offset ) )
{
ms_log (2, "Invalid blockette offset (%d) less than current offset (%d)\n",
ms_log (2, "Invalid blockette offset (%d) less than or equal to current offset (%d)\n",
next_blkt, blkt_offset);
return -1;
}
Expand Down

0 comments on commit eff4d57

Please sign in to comment.