From 0bd2bf9aae29ec5adc856d12ecf03b799e4b2e28 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 28 Nov 2011 17:19:12 +0000 Subject: [PATCH] The number of segments accepted should be bounded by MCA_BTL_DES_MAX_SEGMENTS and not by 2. This commit was SVN r25515. --- ompi/mca/pml/csum/pml_csum_recvfrag.c | 7 +++---- ompi/mca/pml/ob1/pml_ob1_recvfrag.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ompi/mca/pml/csum/pml_csum_recvfrag.c b/ompi/mca/pml/csum/pml_csum_recvfrag.c index e0dec91fc8..678d56877c 100644 --- a/ompi/mca/pml/csum/pml_csum_recvfrag.c +++ b/ompi/mca/pml/csum/pml_csum_recvfrag.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University + * Copyright (c) 2004-2011 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, @@ -148,8 +148,7 @@ void mca_pml_csum_recv_frag_callback_match(mca_btl_base_module_t* btl, uint16_t csum_received, csum=0; uint32_t csum_data; - /* NTH: FIXME -- we will clobber the stack if num_segments > 2 (see lines 260, 276-281) */ - assert(num_segments < 3); + assert(num_segments <= MCA_BTL_DES_MAX_SEGMENTS); if( OPAL_UNLIKELY(segments->seg_len < OMPI_PML_CSUM_MATCH_HDR_LEN) ) { return; @@ -257,7 +256,7 @@ void mca_pml_csum_recv_frag_callback_match(mca_btl_base_module_t* btl, MCA_PML_CSUM_RECV_REQUEST_MATCHED(match, hdr); if(match->req_bytes_expected > 0) { - struct iovec iov[2]; + struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; uint32_t iov_count = 1; /* diff --git a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c index 52020f835e..acbb6d8ecb 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2011 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, @@ -112,8 +112,7 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl, size_t num_segments = des->des_dst_cnt; size_t bytes_received = 0; - /* NTH: FIXME -- we will clobber the stack if num_segments > 2 (see lines 199, 215-220) */ - assert(num_segments < 3); + assert(num_segments <= MCA_BTL_DES_MAX_SEGMENTS); if( OPAL_UNLIKELY(segments->seg_len < OMPI_PML_OB1_MATCH_HDR_LEN) ) { return; @@ -196,7 +195,7 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl, MCA_PML_OB1_RECV_REQUEST_MATCHED(match, hdr); if(match->req_bytes_expected > 0) { - struct iovec iov[2]; + struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; uint32_t iov_count = 1; /*