Unified · Split
| @@ -233,14 +233,12 @@ static size_t mod_strcspn(const char *string, const char *reject) · 232 unmodified lines | ||
| 233 | 233 | return i; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | −static uint32_t color_string_to_rgba(const char *p, int len) | |
| 236 | +static uint32_t color_string_to_rgba(const char *p, size_t len) | |
| 237 | 237 | { |
| 238 | 238 | uint32_t ret = 0xFF000000; |
| 239 | 239 | const ColorEntry *entry; |
| 240 | 240 | char color_name[100]; |
| 241 | 241 | |
| 242 | − len = FFMIN(FFMAX(len, 0), sizeof(color_name) - 1); | |
| 243 | − | |
| 244 | 242 | if (*p == '#') { |
| 245 | 243 | p++; |
| 246 | 244 | len--; |
| @@ -271,6 +269,7 @@ static uint32_t color_string_to_rgba(const char *p, int len) · 24 unmodified lines | ||
| 271 | 269 | (hex_char_to_number(p[0]) << 28); |
| 272 | 270 | } |
| 273 | 271 | } else { |
| 272 | + len = FFMIN(len, sizeof(color_name) - 1); | |
| 274 | 273 | strncpy(color_name, p, len); |
| 275 | 274 | color_name[len] = '\0'; |
| 276 | 275 | |
| @@ -375,7 +374,7 @@ static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p, · 98 unmodified lines | ||
| 375 | 374 | |
| 376 | 375 | for (i = 0; i < ncolors; i++) { |
| 377 | 376 | const uint8_t *index; |
| 378 | − int len; | |
| 377 | + size_t len; | |
| 379 | 378 | |
| 380 | 379 | ptr += mod_strcspn(ptr, "\"") + 1; |
| 381 | 380 | if (end - ptr < cpp) |