File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ class IntegerCODEC {
5353 * of the variable nvalue gets updated with the number actually use
5454 * (if nvalue exceeds the original value, there might be a buffer
5555 * overrun).
56+ *
57+ * NOTE: Decoding can be performed with an unknown input length. This
58+ * case is indicated by a length of 0; however, nvalue must be provided
59+ * in order for the decoder knows how many values to decode.
5660 */
5761 virtual const uint32_t *decodeArray (const uint32_t *in, const size_t length,
5862 uint32_t *out, size_t &nvalue) = 0;
Original file line number Diff line number Diff line change @@ -745,7 +745,7 @@ const uint32_t *Simple16<MarkLength>::decodeArray(const uint32_t *in,
745745 printf (" simple16 stats[%u]=%f\n " , k, stats[k] * 1.0 / sum);
746746 }
747747#endif
748- ASSERT (in <= endin, std::to_string (in - endin));
748+ ASSERT (len == 0 || in <= endin, std::to_string (in - endin));
749749 return in;
750750}
751751
Original file line number Diff line number Diff line change @@ -637,9 +637,9 @@ const uint32_t *Simple8b<MarkLength>::decodeArray(const uint32_t *in,
637637 printf (" simple8b stats[%u]=%f\n " , k, stats[k] * 1.0 / sum);
638638 }
639639#endif
640- assert (in64 <= finalin64);
640+ assert (len == 0 || in64 <= finalin64);
641641 in = reinterpret_cast <const uint32_t *>(in64);
642- assert (in <= endin);
642+ assert (len == 0 || in <= endin);
643643 // check that we don't overrun the buffer too much?
644644 ASSERT (out < end + 240 , std::to_string (out - end));
645645 nvalue = MarkLength ? actualvalue : out - initout;
You can’t perform that action at this time.
0 commit comments