Missing pragma pack causes gcov crash

MS
Michael Scheiffler
Wed, Jun 14, 2017 9:51 AM

Hey there,

inside the source file 'pjlib-util\src\pjlib-util\pcap.c' there's a
#pragma pack(1)

But after the structure definitions, the pragma is not getting disabled any
more.
This causes a segmentation fault when doing code coverage analysis with
GCOV.

The following patch fixes the bug:

diff --git a/pjlib-util/src/pjlib-util/pcap.c
b/pjlib-util/src/pjlib-util/pcap.c
index 0117a04..071b8ad 100644
--- a/pjlib-util/src/pjlib-util/pcap.c
+++ b/pjlib-util/src/pjlib-util/pcap.c
@@ -89,6 +89,7 @@ struct pj_pcap_file
pj_pcap_hdr            hdr;
pj_pcap_filter  filter;
};
+#pragma pack()

/* Init default filter */
PJ_DEF(void) pj_pcap_filter_default(pj_pcap_filter *filter)

Regards,
Michael

Hey there, inside the source file 'pjlib-util\src\pjlib-util\pcap.c' there's a #pragma pack(1) But after the structure definitions, the pragma is not getting disabled any more. This causes a segmentation fault when doing code coverage analysis with GCOV. The following patch fixes the bug: diff --git a/pjlib-util/src/pjlib-util/pcap.c b/pjlib-util/src/pjlib-util/pcap.c index 0117a04..071b8ad 100644 --- a/pjlib-util/src/pjlib-util/pcap.c +++ b/pjlib-util/src/pjlib-util/pcap.c @@ -89,6 +89,7 @@ struct pj_pcap_file pj_pcap_hdr hdr; pj_pcap_filter filter; }; +#pragma pack() /* Init default filter */ PJ_DEF(void) pj_pcap_filter_default(pj_pcap_filter *filter) Regards, Michael
M
Ming
Thu, Jun 15, 2017 2:19 AM

Hi Michael,

Thanks for the report. I committed your patch in r5605 (
https://trac.pjsip.org/repos/changeset/5605).

Best regards,
Ming

On Wed, Jun 14, 2017 at 5:51 PM, Michael Scheiffler michael@scheiffler.at
wrote:

Hey there,

inside the source file 'pjlib-util\src\pjlib-util\pcap.c' there's a
#pragma pack(1)

But after the structure definitions, the pragma is not getting disabled
any more.
This causes a segmentation fault when doing code coverage analysis with
GCOV.

The following patch fixes the bug:

diff --git a/pjlib-util/src/pjlib-util/pcap.c b/pjlib-util/src/pjlib-util/
pcap.c
index 0117a04..071b8ad 100644
--- a/pjlib-util/src/pjlib-util/pcap.c
+++ b/pjlib-util/src/pjlib-util/pcap.c
@@ -89,6 +89,7 @@ struct pj_pcap_file
pj_pcap_hdr            hdr;
pj_pcap_filter  filter;
};
+#pragma pack()

/* Init default filter */
PJ_DEF(void) pj_pcap_filter_default(pj_pcap_filter *filter)

Regards,
Michael


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Michael, Thanks for the report. I committed your patch in r5605 ( https://trac.pjsip.org/repos/changeset/5605). Best regards, Ming On Wed, Jun 14, 2017 at 5:51 PM, Michael Scheiffler <michael@scheiffler.at> wrote: > Hey there, > > inside the source file 'pjlib-util\src\pjlib-util\pcap.c' there's a > #pragma pack(1) > > But after the structure definitions, the pragma is not getting disabled > any more. > This causes a segmentation fault when doing code coverage analysis with > GCOV. > > The following patch fixes the bug: > > diff --git a/pjlib-util/src/pjlib-util/pcap.c b/pjlib-util/src/pjlib-util/ > pcap.c > index 0117a04..071b8ad 100644 > --- a/pjlib-util/src/pjlib-util/pcap.c > +++ b/pjlib-util/src/pjlib-util/pcap.c > @@ -89,6 +89,7 @@ struct pj_pcap_file > pj_pcap_hdr hdr; > pj_pcap_filter filter; > }; > +#pragma pack() > > /* Init default filter */ > PJ_DEF(void) pj_pcap_filter_default(pj_pcap_filter *filter) > > > > Regards, > Michael > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >