return -1 if location is before data

This commit is contained in:
Ahmet Inan 2018-09-28 08:44:45 +02:00
commit ab44dc4042
2 changed files with 9 additions and 0 deletions

View file

@ -77,6 +77,9 @@ public:
int count = algorithm(syndromes, locations, magnitudes, reinterpret_cast<IndexType *>(erasures), erasures_count);
if (count <= 0)
return count;
for (int i = 0; i < count; ++i)
if ((int)locations[i] < K - data_len)
return -1;
for (int i = 0; i < count; ++i)
if (1 < (int)magnitudes[i])
return -1;
@ -156,6 +159,9 @@ public:
int count = algorithm(syndromes, locations, magnitudes, erasures, erasures_count);
if (count <= 0)
return count;
for (int i = 0; i < count; ++i)
if ((int)locations[i] < K - data_len)
return -1;
for (int i = 0; i < count; ++i)
if (1 < (int)magnitudes[i])
return -1;