Discussion:
[pjsip] Missing pragma pack causes gcov crash
Michael Scheiffler
2017-06-14 09:51:20 UTC
Permalink
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
Ming
2017-06-15 02:19:18 UTC
Permalink
Hi Michael,

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

Best regards,
Ming
Post by Michael Scheiffler
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.
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
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
Loading...