Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.11] python311Packages.uamqp: add patches for CVE-2024-25110 & CVE-2024-27099 #293099

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Extracted from
https://github.com/Azure/azure-c-shared-utility/commit/7ddf017f1c08a82688baf08cbe6111ae38e297b8
(yes, we're two vendored dependencies in at this point) and included
in-tree because fetchpatch has trouble using extraPrefix with newly
created files

--- /dev/null
+++ b/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/inc/azure_c_shared_utility/safe_math.h
@@ -0,0 +1,17 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+#ifndef SAFE_MATH_H
+#define SAFE_MATH_H
+
+#ifndef SIZE_MAX
+#define SIZE_MAX ((size_t)((size_t)~(size_t)0))
+#endif
+
+#define safe_add_size_t(a, b) ((((size_t)(a)) < ((size_t)(SIZE_MAX - ((size_t)(b))))) ? ((size_t)(a) + (size_t)(b)) : SIZE_MAX)
+
+#define safe_subtract_size_t(a, b) (((a) >= (b)) ? ((size_t)(a) - (size_t)(b)) : SIZE_MAX)
+
+#define safe_multiply_size_t(a, b) (((a) == 0 || (b) == 0) ? 0 : (((SIZE_MAX / (size_t)(a)) >= (size_t)(b)) ? (size_t)(a) * (size_t)(b) : SIZE_MAX))
+
+#endif // SAFE_MATH_H
18 changes: 18 additions & 0 deletions pkgs/development/python-modules/uamqp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ buildPythonPackage rec {
extraPrefix = "src/vendor/azure-uamqp-c/";
hash = "sha256-9o3TNKFeJvZRZeS6qo2Zl+JVFrrqAGYWDQbusz4Ou+g=";
})
./1.6.5-CVE-2024-25110.prerequisite.patch
(fetchpatch {
name = "CVE-2024-25110-part-1.patch";
url = "https://github.com/Azure/azure-uamqp-c/commit/30865c9ccedaa32ddb036e87a8ebb52c3f18f695.patch";
stripLen = 1;
extraPrefix = "src/vendor/azure-uamqp-c/";
hash = "sha256-igzZqTLUUyuNcpCUbYHI4RXmWxg+7EC/yyD4DBurR2M=";
})
(fetchpatch {
name = "CVE-2024-27099.patch";
url = "https://github.com/Azure/azure-uamqp-c/commit/2ca42b6e4e098af2d17e487814a91d05f6ae4987.patch";
stripLen = 1;
extraPrefix = "src/vendor/azure-uamqp-c/";
# other files are just tests which aren't run from the python
# builder anyway
includes = [ "src/vendor/azure-uamqp-c/src/link.c" ];
hash = "sha256-EqDfG1xAz5CG8MssSSrz8Yrje5qwF8ri1Kdw+UUu5ms=";
})
# Fix incompatible function pointer conversion error with clang 16.
./clang-fix-incompatible-function-pointer-conversion.patch
];
Expand Down
Loading