Skip to content

Commit eff4d57

Browse files
author
Chad Trabant
committed
Fix infinite loop if blockette chain is corrupt
1 parent e60ab64 commit eff4d57

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2015.070: 2.15
2+
- Fix infinite loop if blockette chain is corrupt. Patch submitted
3+
by Elliott Sales de Andrade.
4+
15
2015.062: 2.14
26
- Fix memory leak when msr_pack() returns after an error. Patch
37
contributed by Larry Baker and Eric Thomas.

libmseed.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ extern "C" {
3030

3131
#include "lmplatform.h"
3232

33-
#define LIBMSEED_VERSION "2.14"
34-
#define LIBMSEED_RELEASE "2015.062"
33+
#define LIBMSEED_VERSION "2.15"
34+
#define LIBMSEED_RELEASE "2015.070"
3535

3636
#define MINRECLEN 128 /* Minimum Mini-SEED record length, 2^7 bytes */
3737
/* Note: the SEED specification minimum is 256 */

parseutils.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Written by Chad Trabant
66
* IRIS Data Management Center
77
*
8-
* modified: 2014.248
8+
* modified: 2015.070
99
***************************************************************************/
1010

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

285285
/* Calculate record size in bytes as 2^(blkt_1000->reclen) */
286286
reclen = (unsigned int) 1 << blkt_1000->reclen;
287-
287+
288288
break;
289289
}
290290

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

0 commit comments

Comments
 (0)