We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0828dff commit 49c138cCopy full SHA for 49c138c
compile.c
@@ -12602,8 +12602,13 @@ static ibf_offset_t
12602
ibf_dump_write(struct ibf_dump *dump, const void *buff, unsigned long size)
12603
{
12604
ibf_offset_t pos = ibf_dump_pos(dump);
12605
+#if SIZEOF_LONG > SIZEOF_INT
12606
+ /* ensure the resulting dump does not exceed UINT_MAX */
12607
+ if (size >= UINT_MAX || pos + size >= UINT_MAX) {
12608
+ rb_raise(rb_eRuntimeError, "dump size exceeds");
12609
+ }
12610
+#endif
12611
rb_str_cat(dump->current_buffer->str, (const char *)buff, size);
- /* TODO: overflow check */
12612
return pos;
12613
}
12614
0 commit comments