[Asterisk-code-review] jansson: Add bogus call at startup to verify required version. (...asterisk[16])

Corey Farrell asteriskteam at digium.com
Thu Mar 7 17:19:44 CST 2019


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11112


Change subject: jansson: Add bogus call at startup to verify required version.
......................................................................

jansson: Add bogus call at startup to verify required version.

Add a call to json_sprintf to ensure we're loading with the required
version.  Without this it's possible to build Asterisk with jansson-2.11
installed but then run on a system with an older copy installed.  This
would result in errors on print formats as well as thread safety issues.

Change-Id: I101aebafe0f9407650206f7c552dad3d69377b5a
---
M main/json.c
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/12/11112/1

diff --git a/main/json.c b/main/json.c
index 9a94767..3c6a910 100644
--- a/main/json.c
+++ b/main/json.c
@@ -697,6 +697,11 @@
 {
 	/* Setup to use Asterisk custom allocators */
 	ast_json_reset_alloc_funcs();
+
+	/* We depend on functionality of jansson-2.11 but don't actually use
+	 * any symbols.  This call to json_sprintf() forces a linker error if
+	 * we somehow try loading with an older jansson library. */
+	json_decref(json_sprintf("%s", ""));
 }
 
 static void json_payload_destructor(void *obj)

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11112
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I101aebafe0f9407650206f7c552dad3d69377b5a
Gerrit-Change-Number: 11112
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190307/d5978ced/attachment.html>


More information about the asterisk-code-review mailing list