<p><a href="https://gerrit.asterisk.org/10194">View Change</a></p><p>2 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10194/1/main/json.c">File main/json.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10194/1/main/json.c@619">Patch Set #1, Line 619:</a> <code style="font-family:monospace,monospace">      return ast_json_pack("{s: o, s: o, s: o}",</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">It looks like this change causes a non-NULL return, apparently "s?" causes invalid UTF to become NUL […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Neither of the patches to jansson fix the bug I was pointing out.  The error struct is set with the NULL pointer error message regardless of if it is allowed or not.  Thus there cannot be any further errors reported.</p><p style="white-space: pre-wrap; word-wrap: break-word;">"{s:s?}"</p><p style="white-space: pre-wrap; word-wrap: break-word;">pack_string() determines if the NULL is allowed by checking for the '?' in the format.  It then calls read_string() but doesn't tell that function that a NULL string is acceptable.  read_string() calls set_error() for the NULL string.  Now no other errors will be set by set_error() for the pack operation.</p><p style="white-space: pre-wrap; word-wrap: break-word;">After looking at read_string() again, it can determine itself if the NULL is optional by checking if the t variable is '?' before calling set_error().</p><p style="white-space: pre-wrap; word-wrap: break-word;">As far as the invalid UTF-8 error on optional strings is concerned, read_string() is not setting the s->has_error = 1 flag which would cause the pack to fail and we would report the error.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10194/1/main/json.c@750">Patch Set #1, Line 750:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">                "number", json_party_number(&party->number),<br>         "name", json_party_name(&party->name),<br>               "subaddress", json_party_subaddress(&party->subaddress));<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">json_party_number / json_party_name / json_party_address all return NULL if !valid so I think this i […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Yes, you are correct.  Not sure how I missed that.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10194">change 10194</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10194"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I8382d28d7d83ee0ce13334e51ae45dbc0bdaef48 </div>
<div style="display:none"> Gerrit-Change-Number: 10194 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 21 Sep 2018 20:48:32 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: No </div>