Skip to content

Commit 5224579

Browse files
Fix error with GalleyVector: if blob has less data then we expect for variated stamp, but still enough we should properly use it
1 parent fa84d62 commit 5224579

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

blobstamper/galley.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ fprintf(stderr, "fixed = %i, var_size = %i\n", fixed_size, var_size);
171171

172172
ORACLE_TYPE oracle = stamp_oracle.ExtractValue(blob);
173173

174-
int size = (double) oracle / ORACLE_MAX * (var_size + 1); /* +1 -- это грубая эмуляция округления вверх. oracle == ORACLE_MAX-1 == 65534 должен дать count_max*/
175-
if (size > var_size) size = var_size; // In case we've hit oracle == ORACLE_MAX boundary
176-
size += fixed_size;
174+
int size = OracleProportion(oracle, stamp->minSize(), stamp->maxSize());
175+
if (size > blob->Size())
176+
size = blob->Size(); // Getting what have been left, if not as much as we wanted
177+
177178
fprintf(stderr,"---- %i %i\n", size, blob->Size());
178179
std::shared_ptr<Blob> blob2 = blob->Chop(size);
179180
res.push_back(blob2);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy