Skip to content

Commit

Permalink
Fix y4mReadUnsignedInt() when no digit char (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
y-guyon authored Dec 1, 2023
1 parent 2da57bc commit edd132f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/shared/y4m.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <assert.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -141,10 +140,10 @@ static avifBool y4mColorSpaceParse(const char * formatString, struct y4mFrameIte
// Returns -1 in case of failure.
int y4mReadUnsignedInt(const char * start, const char * end)
{
if (start >= end) {
if (start >= end || *start < '0' || *start > '9') {
return -1;
}
int64_t value = 0;
int64_t value = *(start++) - '0';
while (start != end && *start >= '0' && *start <= '9') {
value = value * 10 + (*(start++) - '0');
if (value > INT_MAX) {
Expand Down

0 comments on commit edd132f

Please sign in to comment.