Skip to content

Commit 0de51eb

Browse files
committed
Added an assert check on negative numbers for CGATS data format
1 parent 5afc747 commit 0de51eb

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
-----------------------
2+
2.20 Ongoing
3+
-----------------------
4+
15
-----------------------
26
2.19 Featured release
37
-----------------------

src/cmscgats.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,8 +1684,8 @@ cmsBool SetDataFormat(cmsIT8* it8, int n, const char *label)
16841684
return FALSE;
16851685
}
16861686

1687-
if (n >= t -> nSamples) {
1688-
SynError(it8, "More than NUMBER_OF_FIELDS fields.");
1687+
if (n < 0 || n >= t -> nSamples) {
1688+
SynError(it8, "Invalid or more than NUMBER_OF_FIELDS fields.");
16891689
return FALSE;
16901690
}
16911691

@@ -1698,9 +1698,11 @@ cmsBool SetDataFormat(cmsIT8* it8, int n, const char *label)
16981698
}
16991699

17001700

1701-
cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE h, int n, const char *Sample)
1701+
cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE h, int n, const char *Sample)
17021702
{
17031703
cmsIT8* it8 = (cmsIT8*)h;
1704+
1705+
_cmsAssert(n >= 0);
17041706
return SetDataFormat(it8, n, Sample);
17051707
}
17061708

0 commit comments

Comments
 (0)