diff --git a/SOURCES/redhat-bugzilla-1857580.patch b/SOURCES/redhat-bugzilla-1857580.patch
new file mode 100644
index 0000000..0b9b3ad
--- /dev/null
+++ b/SOURCES/redhat-bugzilla-1857580.patch
@@ -0,0 +1,212 @@
+diff -Naurp pcp-4.3.2.orig/qa/1820 pcp-4.3.2/qa/1820
+--- pcp-4.3.2.orig/qa/1820	1970-01-01 10:00:00.000000000 +1000
++++ pcp-4.3.2/qa/1820	2020-11-04 11:14:36.844349843 +1100
+@@ -0,0 +1,40 @@
++#!/bin/sh
++# PCP QA Test No. 1820
++# Exercise memory allocation bug in pcp-atopsar(1).
++#
++# Copyright (c) 2020 Red Hat.  All Rights Reserved.
++#
++
++seq=`basename $0`
++if [ $# -eq 0 ]
++then
++    echo "QA output created by $seq"
++else
++    echo "QA output created by $seq $*"
++fi
++
++# get standard environment, filters and checks
++. ./common.product
++. ./common.filter
++. ./common.check
++
++[ -f $PCP_BINADM_DIR/pcp-atopsar ] || _notrun "system monitoring tools not installed"
++
++_cleanup()
++{
++    cd $here
++    $sudo rm -rf $tmp $tmp.*
++}
++
++status=1	# failure is the default!
++$sudo rm -rf $tmp $tmp.* $seq.full
++trap "_cleanup; exit \$status" 0 1 2 3 15
++
++# real QA test starts here
++export PCP_HOSTZONE=1
++export PCP_ARCHIVE=$here/archives/pcp-atop-log
++$PCP_BINADM_DIR/pcp-atopsar -x -R 5 2 10
++
++# success, all done
++status=0
++exit
+diff -Naurp pcp-4.3.2.orig/qa/1820.out pcp-4.3.2/qa/1820.out
+--- pcp-4.3.2.orig/qa/1820.out	1970-01-01 10:00:00.000000000 +1000
++++ pcp-4.3.2/qa/1820.out	2020-11-04 11:14:36.844349843 +1100
+@@ -0,0 +1,14 @@
++QA output created by 1820
++
++        2020/07/20
++
++-------------------------- analysis date: 2013/09/26 --------------------------
++
++16:14:15  cpu  %usr %nice %sys %irq %softirq  %steal %guest  %wait %idle  _cpu_
++
++16:14:19  cpu  %usr %nice %sys %irq %softirq  %steal %guest  %wait %idle  _cpu_
++16:14:27  all    23     0    8    2        1       0      0      3   363
++            0     5     3    1    4        4       3      3      4    75
++            1    10     6    8    6        6       6      6      6    52
++            2    11     6    8    6        6       6      6      6    51
++            3    11     6    7    6        6       6      6      6    52
+diff -Naurp pcp-4.3.2.orig/qa/group pcp-4.3.2/qa/group
+--- pcp-4.3.2.orig/qa/group	2020-11-04 11:11:00.757951890 +1100
++++ pcp-4.3.2/qa/group	2020-11-04 11:14:57.290103639 +1100
+@@ -1680,4 +1680,5 @@ BAD
+ 1622 selinux local
+ 1644 pmda.perfevent local
+ 1671 multi-archive archive libpcp pmlogextract pmlogcheck pmdumplog local
++1820 atop local
+ 4751 libpcp threads valgrind local pcp python
+diff -Naurp pcp-4.3.2.orig/src/pcp/atop/deviate.c pcp-4.3.2/src/pcp/atop/deviate.c
+--- pcp-4.3.2.orig/src/pcp/atop/deviate.c	2020-11-04 11:11:00.762951830 +1100
++++ pcp-4.3.2/src/pcp/atop/deviate.c	2020-11-04 11:14:36.846349819 +1100
+@@ -7,7 +7,7 @@
+ ** This source-file contains functions to calculate the differences for
+ ** the system-level and process-level counters since the previous sample.
+ **
+-** Copyright (C) 2015,2017,2019 Red Hat.
++** Copyright (C) 2015,2017,2019-2020 Red Hat.
+ ** Copyright (C) 2000-2010 Gerlof Langeveld
+ **
+ ** This program is free software; you can redistribute it and/or modify it
+@@ -1220,6 +1220,7 @@ deviatsyst(struct sstat *cur, struct sst
+                                    pre->nfs.nfsmounts.nfsmnt[j].pagesmwrite);
+ 	}
+ 
++	dev->nfs.nfsmounts.nfsmnt[i].mountdev[0] = '\0';
+ 	dev->nfs.nfsmounts.nrmounts = cur->nfs.nfsmounts.nrmounts;
+ 
+ 	/*
+@@ -1227,7 +1228,7 @@ deviatsyst(struct sstat *cur, struct sst
+ 	*/
+ 	if (cur->cfs.nrcontainer != dev->cfs.nrcontainer)
+ 	{
+-		size = (cur->cfs.nrcontainer + 1) * sizeof(struct percontainer);
++		size = cur->cfs.nrcontainer * sizeof(struct percontainer);
+ 		dev->cfs.cont = (struct percontainer *)realloc(dev->cfs.cont, size);
+ 		ptrverify(dev->cfs.cont, "deviatsyst cont [%ld]\n", (long)size);
+ 	}
+@@ -1283,6 +1284,12 @@ deviatsyst(struct sstat *cur, struct sst
+ 	** application-specific counters
+ 	** calculate deviations for GPUs
+ 	*/
++	if (cur->gpu.nrgpus != dev->gpu.nrgpus)
++	{
++		size = cur->gpu.nrgpus * sizeof(struct pergpu);
++		dev->gpu.gpu = (struct pergpu *)realloc(dev->gpu.gpu, size);
++		ptrverify(dev->gpu.gpu, "deviatsyst gpu [%ld]\n", (long)size);
++	}
+ 	for (i=0; i < cur->gpu.nrgpus; i++)
+ 	{
+ 	    dev->gpu.gpu[i].gpunr      = i;
+@@ -1325,6 +1332,12 @@ deviatsyst(struct sstat *cur, struct sst
+ 	/*
+ 	** calculate deviations for InfiniBand
+ 	*/
++	if (cur->ifb.nrports != dev->ifb.nrports)
++	{
++		size = (cur->ifb.nrports + 1) * sizeof(struct perifb);
++		dev->ifb.ifb = (struct perifb *)realloc(dev->ifb.ifb, size);
++		ptrverify(dev->ifb.ifb, "deviatsyst ifb [%ld]\n", (long)size);
++	}
+ 	for (i=0; i < cur->ifb.nrports; i++)
+ 	{
+ 		strcpy(dev->ifb.ifb[i].ibname, cur->ifb.ifb[i].ibname);
+@@ -1343,6 +1356,7 @@ deviatsyst(struct sstat *cur, struct sst
+ 		                         pre->ifb.ifb[i].sndp;
+ 	}
+ 
++	dev->ifb.ifb[i].ibname[0] = '\0';
+ 	dev->ifb.nrports = cur->ifb.nrports;
+ 
+ 	/*
+@@ -1374,6 +1388,7 @@ totalsyst(char category, struct sstat *n
+ {
+ 	register int	i;
+ 	count_t		*ctot, *cnew;
++	size_t		size;
+ 
+ 	switch (category)
+ 	{
+@@ -1393,6 +1408,13 @@ totalsyst(char category, struct sstat *n
+ 		tot->cpu.all.steal += new->cpu.all.steal;
+ 		tot->cpu.all.guest += new->cpu.all.guest;
+ 
++		if (tot->cpu.nrcpu < new->cpu.nrcpu || !tot->cpu.cpu)
++		{
++		    size = new->cpu.nrcpu * sizeof(struct percpu);
++		    tot->cpu.cpu = realloc(tot->cpu.cpu, size);
++		    ptrverify(tot->cpu.cpu, "totalsyst cpus [%ld]", (long)size);
++		}
++
+ 		if (new->cpu.nrcpu == 1)
+ 		{
+ 			tot->cpu.cpu[0] = tot->cpu.all;
+@@ -1537,6 +1559,13 @@ totalsyst(char category, struct sstat *n
+ 		tot->net.tcp.MaxConn      = new->net.tcp.MaxConn;
+ 		tot->net.tcp.CurrEstab    = new->net.tcp.CurrEstab;
+ 	
++		if (tot->intf.nrintf < new->intf.nrintf || !tot->intf.intf)
++		{
++		    size = (new->intf.nrintf + 1) * sizeof(struct perintf);
++		    tot->intf.intf = realloc(tot->intf.intf, size);
++		    ptrverify(tot->intf.intf, "totalsyst intfs [%ld]", (long)size);
++		}
++
+ 		for (i=0; new->intf.intf[i].name[0]; i++)
+ 		{
+ 			/*
+@@ -1603,6 +1632,13 @@ totalsyst(char category, struct sstat *n
+ 		break;
+ 
+ 	   case 'd':	/* accumulate disk-related counters */
++		if (tot->dsk.ndsk < new->dsk.ndsk || !tot->dsk.dsk)
++		{
++		    size = (new->dsk.ndsk + 1) * sizeof(struct perdsk);
++		    tot->dsk.dsk = realloc(tot->dsk.dsk, size);
++		    ptrverify(tot->dsk.dsk, "totalsyst disks [%ld]", (long)size);
++		}
++
+ 		for (i=0; new->dsk.dsk[i].name[0]; i++)
+ 		{
+ 			strcpy(tot->dsk.dsk[i].name, new->dsk.dsk[i].name);
+@@ -1618,6 +1654,13 @@ totalsyst(char category, struct sstat *n
+ 		tot->dsk.dsk[i].name[0] = '\0';
+ 		tot->dsk.ndsk = i;
+ 
++		if (tot->dsk.nlvm < new->dsk.nlvm || !tot->dsk.lvm)
++		{
++		    size = (new->dsk.nlvm + 1) * sizeof(struct perdsk);
++		    tot->dsk.lvm = realloc(tot->dsk.lvm, size);
++		    ptrverify(tot->dsk.lvm, "totalsyst LVs [%ld]", (long)size);
++		}
++
+ 		for (i=0; new->dsk.lvm[i].name[0]; i++)
+ 		{
+ 			strcpy(tot->dsk.lvm[i].name, new->dsk.lvm[i].name);
+@@ -1633,6 +1676,13 @@ totalsyst(char category, struct sstat *n
+ 		tot->dsk.lvm[i].name[0] = '\0';
+ 		tot->dsk.nlvm = i;
+ 
++		if (tot->dsk.nmdd < new->dsk.nmdd || !tot->dsk.mdd)
++		{
++		    size = (new->dsk.nmdd + 1) * sizeof(struct perdsk);
++		    tot->dsk.mdd = realloc(tot->dsk.mdd, size);
++		    ptrverify(tot->dsk.mdd, "totalsyst MDs [%ld]", (long)size);
++		}
++
+ 		for (i=0; new->dsk.mdd[i].name[0]; i++)
+ 		{
+ 			strcpy(tot->dsk.mdd[i].name, new->dsk.mdd[i].name);
diff --git a/SOURCES/redhat-bugzilla-1878754.patch b/SOURCES/redhat-bugzilla-1878754.patch
new file mode 100644
index 0000000..41aaa58
--- /dev/null
+++ b/SOURCES/redhat-bugzilla-1878754.patch
@@ -0,0 +1,364 @@
+diff -Naurp pcp-4.3.2.orig/qa/1280 pcp-4.3.2/qa/1280
+--- pcp-4.3.2.orig/qa/1280	1970-01-01 10:00:00.000000000 +1000
++++ pcp-4.3.2/qa/1280	2020-11-04 10:58:30.575985524 +1100
+@@ -0,0 +1,86 @@
++#!/bin/sh
++# PCP QA Test No. 1280
++# segv in __pmGetArchiveEnd_ctx()
++#
++# Copyright (c) 2020 Ken McDonell.  All Rights Reserved.
++#
++
++if [ $# -eq 0 ]
++then
++    seq=`basename $0`
++    echo "QA output created by $seq"
++else
++    # use $seq from caller, unless not set
++    [ -n "$seq" ] || seq=`basename $0`
++    echo "QA output created by `basename $0` $*"
++fi
++
++# get standard environment, filters and checks
++. ./common.product
++. ./common.filter
++. ./common.check
++
++do_valgrind=false
++if [ "$1" = "--valgrind" ]
++then
++    _check_valgrind
++    do_valgrind=true
++fi
++
++if which unxz >/dev/null
++then
++    :
++else
++    _notrun "need unxz application installed"
++fi
++
++_cleanup()
++{
++    cd $here
++    $sudo rm -rf $tmp $tmp.*
++}
++
++status=0	# success is the default!
++$sudo rm -rf $tmp $tmp.* $seq.full
++trap "_cleanup; exit \$status" 0 1 2 3 15
++
++_doit()
++{
++    if $do_valgrind
++    then
++	_run_valgrind pmdumplog -z -Dlog -L 20180416.10.00
++    else
++	pmdumplog -z -Dlog -L 20180416.10.00 2>>$here/$seq.full
++    fi
++}
++
++# real QA test starts here
++mkdir $tmp
++cp archives/20180416.10.00* $tmp
++cd $tmp
++for f in *.xz
++do
++    unxz $f
++done
++
++echo "=== full archive ==="
++_doit
++
++echo
++echo "=== volume 3 missing ==="
++rm 20180416.10.00.3
++_doit
++
++echo
++echo "=== volume 2 truncated ==="
++size=`stat 20180416.10.00.2 | sed -n -e '/Size:/{
++s/.*Size: *//
++s/ .*//
++p
++}'`
++size=`expr $size - 8`
++truncate -s $size 20180416.10.00.2
++_doit
++
++# success, all done
++exit
+diff -Naurp pcp-4.3.2.orig/qa/1280.out pcp-4.3.2/qa/1280.out
+--- pcp-4.3.2.orig/qa/1280.out	1970-01-01 10:00:00.000000000 +1000
++++ pcp-4.3.2/qa/1280.out	2020-11-04 10:58:30.575985524 +1100
+@@ -0,0 +1,30 @@
++QA output created by 1280
++=== full archive ===
++Note: timezone set to local timezone of host "brolley-t530" from archive
++
++Log Label (Log Format Version 2)
++Performance metrics from host brolley-t530
++    commencing Mon Apr 16 10:01:25.325401 2018
++    ending     Mon Apr 16 14:32:47.409469 2018
++Archive timezone: EDT+4
++PID for pmlogger: 7047
++
++=== volume 3 missing ===
++Note: timezone set to local timezone of host "brolley-t530" from archive
++
++Log Label (Log Format Version 2)
++Performance metrics from host brolley-t530
++    commencing Mon Apr 16 10:01:25.325401 2018
++    ending     Mon Apr 16 14:26:25.396920 2018
++Archive timezone: EDT+4
++PID for pmlogger: 7047
++
++=== volume 2 truncated ===
++Note: timezone set to local timezone of host "brolley-t530" from archive
++
++Log Label (Log Format Version 2)
++Performance metrics from host brolley-t530
++    commencing Mon Apr 16 10:01:25.325401 2018
++    ending     Mon Apr 16 14:26:25.380430 2018
++Archive timezone: EDT+4
++PID for pmlogger: 7047
+diff -Naurp pcp-4.3.2.orig/qa/1281 pcp-4.3.2/qa/1281
+--- pcp-4.3.2.orig/qa/1281	1970-01-01 10:00:00.000000000 +1000
++++ pcp-4.3.2/qa/1281	2020-11-04 10:58:30.575985524 +1100
+@@ -0,0 +1,52 @@
++#!/bin/sh
++# PCP QA Test No. 1281
++# segv in __pmGetArchiveEnd_ctx()
++#
++# -- valgrind version of qa/1280
++#
++# Copyright (c) 2020 Ken McDonell.  All Rights Reserved.
++#
++
++if [ $# -eq 0 ]
++then
++    seq=`basename $0`
++    echo "QA output created by $seq"
++else
++    # use $seq from caller, unless not set
++    [ -n "$seq" ] || seq=`basename $0`
++    echo "QA output created by `basename $0` $*"
++fi
++
++# get standard environment, filters and checks
++. ./common.product
++. ./common.filter
++. ./common.check
++
++do_valgrind=false
++if [ "$1" = "--valgrind" ]
++then
++    _check_valgrind
++    do_valgrind=true
++fi
++
++_cleanup()
++{
++    cd $here
++    $sudo rm -rf $tmp $tmp.*
++}
++
++status=0	# success is the default!
++$sudo rm -rf $tmp $tmp.* $seq.full
++trap "_cleanup; exit \$status" 0 1 2 3 15
++
++# real QA test starts here
++export seq
++./1280 --valgrind \
++| $PCP_AWK_PROG '
++skip == 1 && $1 == "==="	{ skip = 0 }
++/^=== std err ===/		{ skip = 1 }
++skip == 0		{ print }
++skip == 1		{ print >"'$here/$seq.full'" }'
++
++# success, all done
++exit
+diff -Naurp pcp-4.3.2.orig/qa/1281.out pcp-4.3.2/qa/1281.out
+--- pcp-4.3.2.orig/qa/1281.out	1970-01-01 10:00:00.000000000 +1000
++++ pcp-4.3.2/qa/1281.out	2020-11-04 10:58:30.575985524 +1100
+@@ -0,0 +1,55 @@
++QA output created by 1281
++QA output created by 1280 --valgrind
++=== full archive ===
++=== std out ===
++Note: timezone set to local timezone of host "brolley-t530" from archive
++
++Log Label (Log Format Version 2)
++Performance metrics from host brolley-t530
++    commencing Mon Apr 16 10:01:25.325401 2018
++    ending     Mon Apr 16 14:32:47.409469 2018
++Archive timezone: EDT+4
++PID for pmlogger: 7047
++=== filtered valgrind report ===
++Memcheck, a memory error detector
++Command: pmdumplog -z -Dlog -L 20180416.10.00
++LEAK SUMMARY:
++definitely lost: 0 bytes in 0 blocks
++indirectly lost: 0 bytes in 0 blocks
++ERROR SUMMARY: 0 errors from 0 contexts ...
++
++=== volume 3 missing ===
++=== std out ===
++Note: timezone set to local timezone of host "brolley-t530" from archive
++
++Log Label (Log Format Version 2)
++Performance metrics from host brolley-t530
++    commencing Mon Apr 16 10:01:25.325401 2018
++    ending     Mon Apr 16 14:26:25.396920 2018
++Archive timezone: EDT+4
++PID for pmlogger: 7047
++=== filtered valgrind report ===
++Memcheck, a memory error detector
++Command: pmdumplog -z -Dlog -L 20180416.10.00
++LEAK SUMMARY:
++definitely lost: 0 bytes in 0 blocks
++indirectly lost: 0 bytes in 0 blocks
++ERROR SUMMARY: 0 errors from 0 contexts ...
++
++=== volume 2 truncated ===
++=== std out ===
++Note: timezone set to local timezone of host "brolley-t530" from archive
++
++Log Label (Log Format Version 2)
++Performance metrics from host brolley-t530
++    commencing Mon Apr 16 10:01:25.325401 2018
++    ending     Mon Apr 16 14:26:25.380430 2018
++Archive timezone: EDT+4
++PID for pmlogger: 7047
++=== filtered valgrind report ===
++Memcheck, a memory error detector
++Command: pmdumplog -z -Dlog -L 20180416.10.00
++LEAK SUMMARY:
++definitely lost: 0 bytes in 0 blocks
++indirectly lost: 0 bytes in 0 blocks
++ERROR SUMMARY: 0 errors from 0 contexts ...
+diff -Naurp pcp-4.3.2.orig/qa/417.out pcp-4.3.2/qa/417.out
+--- pcp-4.3.2.orig/qa/417.out	2018-06-19 09:19:05.000000000 +1000
++++ pcp-4.3.2/qa/417.out	2020-11-04 10:44:15.722280608 +1100
+@@ -253,6 +253,11 @@ Temporal Index
+ === pmdumplog -t, no index ===
+ Note: timezone set to local timezone of host "moomba" from archive
+ 
++pmdumplog: Cannot locate end of archive bad: Corrupted record in a PCP archive log
++
++WARNING: This archive is sufficiently damaged that it may not be possible to
++         produce complete information.  Continuing and hoping for the best.
++
+ 
+ Temporal Index
+ 		Log Vol    end(meta)     end(log)
+diff -Naurp pcp-4.3.2.orig/qa/group pcp-4.3.2/qa/group
+--- pcp-4.3.2.orig/qa/group	2020-11-04 10:43:55.184527945 +1100
++++ pcp-4.3.2/qa/group	2020-11-04 10:58:43.746826907 +1100
+@@ -1614,6 +1614,8 @@ BAD
+ 1269 libpcp local kernel
+ 1274 pmlogextract pmdumplog labels help local sanity
+ 1276 pmmgr containers local
++1280 archive pmdumplog local
++1281 archive pmdumplog valgrind local
+ 1287 pmda.install pmda.prometheus local python
+ 1289 pmval archive multi-archive decompress-xz local pmlogextract
+ 1294 libpcp_mmv labels local valgrind
+diff -Naurp pcp-4.3.2.orig/src/libpcp/src/logutil.c pcp-4.3.2/src/libpcp/src/logutil.c
+--- pcp-4.3.2.orig/src/libpcp/src/logutil.c	2019-02-26 07:30:38.000000000 +1100
++++ pcp-4.3.2/src/libpcp/src/logutil.c	2020-11-04 10:44:15.722280608 +1100
+@@ -2558,6 +2558,11 @@ __pmGetArchiveEnd_ctx(__pmContext *ctxp,
+     found = 0;
+     sts = PM_ERR_LOGREC;	/* default error condition */
+     f = NULL;
++
++    /*
++     * start at last volume and work backwards until success or
++     * failure
++     */
+     for (vol = lcp->l_maxvol; vol >= lcp->l_minvol; vol--) {
+ 	if (acp->ac_curvol == vol) {
+ 	    f = acp->ac_mfp;
+@@ -2571,11 +2576,7 @@ __pmGetArchiveEnd_ctx(__pmContext *ctxp,
+ 
+ 	if (__pmFstat(f, &sbuf) < 0) {
+ 	    /* if we can't stat() this one, then try previous volume(s) */
+-	    if (f != acp->ac_mfp) {
+-		__pmFclose(f);
+-		f = NULL;
+-	    }
+-	    continue;
++	    goto prior_vol;
+ 	}
+ 
+ 	if (vol == lcp->l_maxvol && sbuf.st_size == lcp->l_physend) {
+@@ -2588,16 +2589,14 @@ __pmGetArchiveEnd_ctx(__pmContext *ctxp,
+ 
+ 	/* if this volume is empty, try previous volume */
+ 	if (sbuf.st_size <= (int)sizeof(__pmLogLabel) + 2*(int)sizeof(int)) {
+-	    if (f != acp->ac_mfp) {
+-		__pmFclose(f);
+-		f = NULL;
+-	    }
+-	    continue;
++	    goto prior_vol;
+ 	}
+ 
+ 	physend = (__pm_off_t)sbuf.st_size;
+ 	if (sizeof(off_t) > sizeof(__pm_off_t)) {
++	    /* 64-bit off_t */
+ 	    if (physend != sbuf.st_size) {
++		/* oops, 32-bit offset not the same */
+ 		pmNotifyErr(LOG_ERR, "pmGetArchiveEnd: PCP archive file"
+ 			" (meta) too big (%"PRIi64" bytes)\n",
+ 			(uint64_t)sbuf.st_size);
+@@ -2621,18 +2620,17 @@ __pmGetArchiveEnd_ctx(__pmContext *ctxp,
+ 	 */
+ 	logend = (int)sizeof(__pmLogLabel) + 2*(int)sizeof(int);
+ 	for (i = lcp->l_numti - 1; i >= 0; i--) {
+-	    if (lcp->l_ti[i].ti_vol != vol) {
+-		if (f != acp->ac_mfp) {
+-		    __pmFclose(f);
+-		    f = NULL;
+-		}
++	    if (lcp->l_ti[i].ti_vol != vol)
+ 		continue;
+-	    }
+ 	    if (lcp->l_ti[i].ti_log <= physend) {
+ 		logend = lcp->l_ti[i].ti_log;
+ 		break;
+ 	    }
+ 	}
++	if (i < 0) {
++	    /* no dice in the temporal index, try previous volume */
++	    goto prior_vol;
++	}
+ 
+ 	/*
+ 	 * Now chase it forwards from the last index entry ...
+@@ -2642,6 +2640,7 @@ __pmGetArchiveEnd_ctx(__pmContext *ctxp,
+ 	 *	valid record, so if not at start of volume, back up one
+ 	 *	record, then scan forwards.
+ 	 */
++	assert(f != NULL);
+ 	__pmFseek(f, (long)logend, SEEK_SET);
+ 	if (logend > (int)sizeof(__pmLogLabel) + 2*(int)sizeof(int)) {
+ 	    if (paranoidLogRead(ctxp, PM_MODE_BACK, f, &rp) < 0) {
+@@ -2681,10 +2680,17 @@ __pmGetArchiveEnd_ctx(__pmContext *ctxp,
+ 	if (found)
+ 	    break;
+ 
++prior_vol:
+ 	/*
+ 	 * this probably means this volume contains no useful records,
+ 	 * try the previous volume
+ 	 */
++	if (f != acp->ac_mfp) {
++	    /* f comes from _logpeek(), close it */
++	    __pmFclose(f);
++	    f = NULL;
++	}
++
+     }/*for*/
+ 
+     if (f == acp->ac_mfp)
diff --git a/SPECS/pcp.spec b/SPECS/pcp.spec
index 65f4b1e..351e997 100644
--- a/SPECS/pcp.spec
+++ b/SPECS/pcp.spec
@@ -1,6 +1,6 @@
 Name:    pcp
 Version: 4.3.2
-Release: 12%{?dist}
+Release: 13%{?dist}
 Summary: System-level performance monitoring and performance management
 License: GPLv2+ and LGPLv2+ and CC-BY
 URL:     https://pcp.io
@@ -27,6 +27,8 @@ Patch009: redhat-bugzilla-1764748.patch
 Patch010: redhat-bugzilla-1765641.patch
 Patch011: redhat-bugzilla-1775373.patch
 Patch012: redhat-bugzilla-1818710.patch
+Patch013: redhat-bugzilla-1857580.patch
+Patch014: redhat-bugzilla-1878754.patch
 
 %if 0%{?fedora} >= 26 || 0%{?rhel} > 7
 %global __python2 python2
@@ -2120,6 +2122,8 @@ adjustments for an updated policy package.
 %patch010 -p1
 %patch011 -p1
 %patch012 -p1
+%patch013 -p1
+%patch014 -p1
 
 %build
 %if !%{disable_python2} && 0%{?default_python} != 3
@@ -3280,6 +3284,10 @@ cd
 %endif
 
 %changelog
+* Wed Nov 04 2020 Nathan Scott <nathans@redhat.com> - 4.3.2-13
+- Fix pcp-atopsar memory allocation problem with some options (BZ 1857580)
+- Fix __pmGetArchiveEnd_ctx sigsegv with corrupt PCP archives (BZ 1878754)
+
 * Wed Jun 10 2020 Nathan Scott <nathans@redhat.com> - 4.3.2-12
 - Fix pcp-atop dynamic memory initialization issues (BZ 1818710)