Created
September 1, 2025 13:56
-
-
Save petere/cedade2084d016ff42d9370c9a8b4eca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/common/hmac.c b/src/common/hmac.c | |
index ab8174f..0a87bed 100644 | |
--- a/src/common/hmac.c | |
+++ b/src/common/hmac.c | |
@@ -123,9 +123,9 @@ pg_hmac_create(pg_cryptohash_type type) | |
int | |
pg_hmac_init(pg_hmac_ctx *ctx, const uint8 *key, size_t len) | |
{ | |
- int i; | |
- int digest_size; | |
- int block_size; | |
+ size_t i; | |
+ size_t digest_size; | |
+ size_t block_size; | |
uint8 *shrinkbuf = NULL; | |
if (ctx == NULL) | |
diff --git a/src/common/saslprep.c b/src/common/saslprep.c | |
index cb8844e..8d5aa4c 100644 | |
--- a/src/common/saslprep.c | |
+++ b/src/common/saslprep.c | |
@@ -998,7 +998,7 @@ static int | |
pg_utf8_string_len(const char *source) | |
{ | |
const unsigned char *p = (const unsigned char *) source; | |
- int l; | |
+ size_t l; | |
int num_chars = 0; | |
size_t len = strlen(source); | |
@@ -1043,11 +1043,11 @@ pg_saslprep(const char *input, char **output) | |
{ | |
pg_wchar *input_chars = NULL; | |
pg_wchar *output_chars = NULL; | |
- int input_size; | |
+ size_t input_size; | |
char *result; | |
int result_size; | |
int count; | |
- int i; | |
+ size_t i; | |
bool contains_RandALCat; | |
unsigned char *p; | |
pg_wchar *wp; | |
@@ -1073,8 +1073,6 @@ pg_saslprep(const char *input, char **output) | |
* This also checks that the input is a legal UTF-8 string. | |
*/ | |
input_size = pg_utf8_string_len(input); | |
- if (input_size < 0) | |
- return SASLPREP_INVALID_UTF8; | |
if (input_size >= MaxAllocSize / sizeof(pg_wchar)) | |
goto oom; | |
diff --git a/src/common/unicode_norm.c b/src/common/unicode_norm.c | |
index 3b1ee58..ac42271 100644 | |
--- a/src/common/unicode_norm.c | |
+++ b/src/common/unicode_norm.c | |
@@ -281,7 +281,7 @@ recompose_code(uint32 start, uint32 code, uint32 *result) | |
#else | |
- int i; | |
+ size_t i; | |
for (i = 0; i < lengthof(UnicodeDecompMain); i++) | |
{ | |
diff --git a/src/common/wchar.c b/src/common/wchar.c | |
index 1287cca..09dd284 100644 | |
--- a/src/common/wchar.c | |
+++ b/src/common/wchar.c | |
@@ -1901,9 +1901,9 @@ pg_utf8_verifystr(const unsigned char *s, int len) | |
*/ | |
#define STRIDE_LENGTH (2 * sizeof(Vector8)) | |
- if (len >= STRIDE_LENGTH) | |
+ if ((size_t) len >= STRIDE_LENGTH) | |
{ | |
- while (len >= STRIDE_LENGTH) | |
+ while ((size_t) len >= STRIDE_LENGTH) | |
{ | |
/* | |
* If the chunk is all ASCII, we can skip the full UTF-8 check, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment