2
0
Эх сурвалжийг харах

throw error on negative allocation size

Nicolas Cannasse 2 жил өмнө
parent
commit
2be3f7a9e6
1 өөрчлөгдсөн 2 нэмэгдсэн , 0 устгасан
  1. 2 0
      src/gc.c

+ 2 - 0
src/gc.c

@@ -475,6 +475,8 @@ void *hl_gc_alloc_gen( hl_type *t, int size, int flags ) {
 	int allocated = 0;
 	if( size == 0 )
 		return NULL;
+	if( size < 0 )
+		hl_error("Invalid allocation size");
 	gc_global_lock(true);
 	gc_check_mark();
 #	ifdef GC_MEMCHK