git: 3b7150730727 - main - devel/arcanist-lib: Handle NULL argument passed to strlen()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 09 Jan 2023 22:36:28 UTC
The branch main has been updated by jrm:
URL: https://cgit.FreeBSD.org/ports/commit/?id=3b715073072794942506d27d72b2b23551c4fd30
commit 3b715073072794942506d27d72b2b23551c4fd30
Author: Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2023-01-09 21:27:58 +0000
Commit: Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2023-01-09 22:35:17 +0000
devel/arcanist-lib: Handle NULL argument passed to strlen()
Problem description:
- ArcanistDiffWorkflow.php:getDiffOntoTargets() tries to determine the
current branch name by calling ArcanistGitAPI.php:getBranchName()
- getBranchName() returns NULL when working on a detached HEAD
- getDiffOntoTargets() calls strlen() with the branch name, which now
fails with a NULL argument.
Approved by: grembo (maintainer)
Sponsored by: The FreeBSD Foundation
---
devel/arcanist-lib/Makefile | 2 +-
.../files/patch-src_workflow_ArcanistDiffWorkflow.php | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/devel/arcanist-lib/Makefile b/devel/arcanist-lib/Makefile
index 8fbe5718f993..88851111a747 100644
--- a/devel/arcanist-lib/Makefile
+++ b/devel/arcanist-lib/Makefile
@@ -1,6 +1,6 @@
PORTNAME?= arcanist
PORTVERSION?= 20220518
-PORTREVISION?= 2
+PORTREVISION?= 3
CATEGORIES?= devel
PKGNAMESUFFIX= ${SLAVE_PKGNAMESUFFIX}${PHP_PKGNAMESUFFIX}
diff --git a/devel/arcanist-lib/files/patch-src_workflow_ArcanistDiffWorkflow.php b/devel/arcanist-lib/files/patch-src_workflow_ArcanistDiffWorkflow.php
new file mode 100644
index 000000000000..f132ed21d524
--- /dev/null
+++ b/devel/arcanist-lib/files/patch-src_workflow_ArcanistDiffWorkflow.php
@@ -0,0 +1,11 @@
+--- src/workflow/ArcanistDiffWorkflow.php.orig 2023-01-09 21:24:25 UTC
++++ src/workflow/ArcanistDiffWorkflow.php
+@@ -2361,7 +2361,7 @@ EOTEXT
+
+ // If we track an upstream branch either directly or indirectly, use that.
+ $branch = $api->getBranchName();
+- if (strlen($branch)) {
++ if (strlen($branch ?? '')) {
+ $upstream_path = $api->getPathToUpstream($branch);
+ $remote_branch = $upstream_path->getRemoteBranchName();
+ if ($remote_branch !== null) {