diff --git a/index.html b/index.html
index 68c6a586b..8d0bdc7a1 100644
--- a/index.html
+++ b/index.html
@@ -318,12 +318,15 @@
uint32_t expectedsize = roaring_bitmap_portable_size_in_bytes(r1);
char *serializedbytes = malloc(expectedsize);
roaring_bitmap_portable_serialize(r1, serializedbytes);
-
-
- roaring_bitmap_t *t = roaring_bitmap_portable_deserialize(serializedbytes);
+ roaring_bitmap_t *t = roaring_bitmap_portable_deserialize_safe(serializedbytes, expectedsize);
+ if(t == NULL) { return EXIT_FAILURE; }
+ const char *reason = NULL;
+ if (!roaring_bitmap_internal_validate(t, &reason)) {
+ return EXIT_FAILURE;
+ }
assert(roaring_bitmap_equals(r1, t));
roaring_bitmap_free(t);
@@ -334,6 +337,18 @@
expectedsize);
t = roaring_bitmap_portable_deserialize_safe(serializedbytes, expectedsize);
+ if(t == NULL) {
+ printf("Problem during deserialization.\n");
+
+ return EXIT_FAILURE;
+ }
+
+ const char *reason_failure = NULL;
+ if (!roaring_bitmap_internal_validate(t, &reason_failure)) {
+ printf("safely deserialized invalid bitmap: %s\n", reason_failure);
+
+ return EXIT_FAILURE;
+ }