Skip to content

Commit 3c80dd5

Browse files
committed
CMake: Clean up leftover attribution values during SBOM generation
When processing multiple attribution files to collect all attribution ids, the values of the previous iteration extracted keys were not reset. This caused the values to leak to the next processed attribution id target if the specific id key was empty. Make sure to clean up the values before parsing the next attribution key. Pick-to: 6.8 6.9 Change-Id: I386fc9c09276c49207382b06605efeb0d939b6da Reviewed-by: Alexey Edelev <[email protected]>
1 parent 11b54b8 commit 3c80dd5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmake/QtPublicSbomAttributionHelpers.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,9 @@ endfunction()
524524
macro(_qt_internal_sbom_get_attribution_key json_key out_var out_prefix)
525525
cmake_parse_arguments(arg "IS_MULTI_VALUE" "" "" ${ARGN})
526526

527+
# Reset any leftover value that might have been set in a previous iteration.
528+
set(${out_prefix}_${out_var} "" PARENT_SCOPE)
529+
527530
string(JSON "${out_var}" ERROR_VARIABLE get_error GET "${contents}" ${indices} "${json_key}")
528531
if(NOT "${${out_var}}" STREQUAL "" AND NOT get_error)
529532
set(extracted_value "${${out_var}}")

0 commit comments

Comments
 (0)