Bug #108629 MySQL Shell segfault when a string of length 0 is inputed
Submitted: 28 Sep 2022 8:28 Modified: 28 Oct 2022 9:41
Reporter: Steven Curry Email Updates:
Status: No Feedback Impact on me:
None 
Category:Shell General / Core Client Severity:S3 (Non-critical)
Version:8.0.23 OS:Any
Assigned to: CPU Architecture:Any

[28 Sep 2022 8:28] Steven Curry
Description:
When using the MySQL Shell 8.0.23 util.checkForServerUpgrade() function, if the targetVersion parameter is "", it will automatically exit and no other logging information will be output. With dmesg -T, you can see the following segment error message.
mysqlsh[66014]: segfault at 8 ip 0000000000ff1120 sp 00007ffedcbc4f30 error 4 in mysqlsh[400000+209d000]
mysqlsh[68858]: segfault at 8 ip 0000000000ff1120 sp 00007sgedcb5440 error 4 in mysqlsh[400000+209d000]

However, with MySQL Shell 8.0.28, the same input "" can be successfully execution.

How to repeat:
1. connect mysqlsh (8.0.23)
2. util.checkForServerUpgrade("root@127.0.0.1:3306",{
  "password": "123456",
  "targetVersion": "",
  "outputFormat": "JSON"
})

Suggested fix:
Add a check for the incoming parameter, if it is "", it will prompt an error
[28 Sep 2022 9:13] Steven Curry
change bug category
[28 Sep 2022 9:18] Steven Curry
Log content:
root@sc:~# cat /root/.mysqlsh/mysqlsh.log
2022-09-28 09:00:20: Info: Using credential store helper: /usr/bin/mysql-secret-store-login-path
2022-09-28 09:00:20: Info: Loading startup files...
2022-09-28 09:00:20: Info: Loading plugins...
[28 Sep 2022 9:41] MySQL Verification Team
Hello Steven Curry,

Thank you for the report and feedback.
Please note that we don't fix bugs in old versions(as you confirmed no issues in MySQL Shell 8.0.28 when using ""), don't back-port bug fixes, so you need to check with latest MySQL Shell version(8.0.30). So, please upgrade MySQL Shell to 8.0.30 and inform us if problem still exists. Thank you.

regards,
Umesh
[29 Oct 2022 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".