[Asterisk-code-review] res_pjsip: Replace invalid UTF-8 sequences in callerid name (asterisk[18])

George Joseph asteriskteam at digium.com
Tue Feb 28 06:19:10 CST 2023


Attention is currently required from: Sean Bright, Joshua Colp.

George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/19898 )

Change subject: res_pjsip: Replace invalid UTF-8 sequences in callerid name
......................................................................


Patch Set 7:

(4 comments)

Patchset:

PS6: 
> I want to do some testing of how the replacement characters are handled, but at a minimum the refactoring of the JSON UTF-8 routines to use the ones in utf8.h should happen in a different review.

Will split.
> 
> Additionally, I don't understand why unrelated UTF-8 functions were modified (switching an 'assert' to an 'if' for example)?

I'll revert that.  I just noticed that it would cause the dst buffer to be unterminated if size were 0.


File include/asterisk/utf8.h:

https://gerrit.asterisk.org/c/asterisk/+/19898/comment/9a50072d_a1f955b0 
PS7, Line 136:  * 3 byte sequence, the destination buffer will beed to be larger than
> need
Done


File main/stasis_channels.c:

https://gerrit.asterisk.org/c/asterisk/+/19898/comment/fbc516e9_515ce203 
PS7, Line 1168: 	result = ast_utf8_replace_invalid_chars(new_value, &new_value_size,
> How expensive of an operation is this?

Given that the strings tend to be short and there's no complicated math, not very...
I ran the unit tests in a loop and got this...

$ gcc -O2 -o test test.c
$ time ./test
tests: 181000  pass: 181000  fail: 0

real	0m0.032s
user	0m0.032s
sys	0m0.001s

On a RaspberryPi 😊


File tests/test_json.c:

https://gerrit.asterisk.org/c/asterisk/+/19898/comment/f8f1c46d_34940bd8 
PS7, Line 1726: 				 "app_data", ""
> This is a behavior change in the internal event, which can be used by things. Is it possible to maintain existing behavior?

pulling json.c changes to separate review.



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

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I4ffbdb19c80bf0efc675d40078a3ca4f85c567d8
Gerrit-Change-Number: 19898
Gerrit-PatchSet: 7
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-Attention: Sean Bright <sean at seanbright.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Tue, 28 Feb 2023 12:19:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sean Bright <sean at seanbright.com>
Comment-In-Reply-To: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230228/b79f3a42/attachment-0001.html>


More information about the asterisk-code-review mailing list