Skip to content

Commit

Permalink
build: fix C string encoding for PRODUCT_DIR_ABS
Browse files Browse the repository at this point in the history
Since the `PRODUCT_DIR_ABS` gyp variable is meant to be used
in a C string in the OpenSSL config, provide a version of it
that actually provides it in a way that is always usable as a
C string. Otherwise, unescaped characters in the path can mess
with the string definitions; for example, building in paths
on Windows whose directories start with valid or invalid escape
sequences (e.g.: `C:\...\x61foobar\...` or `C:\...\456789\...`)
can result in failing builds or incorrect paths provided to
OpenSSL.

PR-URL: #56111
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
addaleax authored and nodejs-github-bot committed Dec 12, 2024
1 parent a963b5e commit 203398d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions deps/openssl/openssl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@
'nasm_version%': '0.0',
'openssl-cli': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)openssl-cli<(EXECUTABLE_SUFFIX)',
'conditions': [
['OS == "win"', {
'obj_dir_abs': '<(PRODUCT_DIR_ABS)/obj',
}],
['GENERATOR == "ninja"', {
'obj_dir_abs': '<(PRODUCT_DIR_ABS)/obj',
'modules_dir': '<(PRODUCT_DIR_ABS)/obj/lib/openssl-modules',
'modules_dir': '<(PRODUCT_DIR_ABS_CSTR)/obj/lib/openssl-modules',
}, {
'obj_dir_abs%': '<(PRODUCT_DIR_ABS)/obj.target',
'modules_dir': '<(PRODUCT_DIR_ABS)/obj.target/deps/openssl/lib/openssl-modules',
'modules_dir': '<(PRODUCT_DIR_ABS_CSTR)/obj.target/deps/openssl/lib/openssl-modules',
}],
['OS=="mac"', {
'obj_dir_abs%': '<(PRODUCT_DIR_ABS)/obj.target',
'modules_dir': '<(PRODUCT_DIR_ABS)/obj.target/deps/openssl/lib/openssl-modules',
'modules_dir': '<(PRODUCT_DIR_ABS_CSTR)/obj.target/deps/openssl/lib/openssl-modules',
}],
],
},
Expand Down

0 comments on commit 203398d

Please sign in to comment.