aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/gendata_cocsep.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-12 16:23:05 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-12 16:23:05 +0200
commit182e2d45678d0487be71370c37b88daca3d2c54b (patch)
tree3987ecd9bade082a7b41901c2376daa73401e548 /src/solvers/h48/gendata_cocsep.h
parentda8fdd4955fd24666643915a6728678e9965a0d3 (diff)
downloadnissy-core-182e2d45678d0487be71370c37b88daca3d2c54b.tar.gz
nissy-core-182e2d45678d0487be71370c37b88daca3d2c54b.zip
Make gendata and co safer by checking buffer size
Diffstat (limited to 'src/solvers/h48/gendata_cocsep.h')
-rw-r--r--src/solvers/h48/gendata_cocsep.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h
index 18bfc38..b46bcf3 100644
--- a/src/solvers/h48/gendata_cocsep.h
+++ b/src/solvers/h48/gendata_cocsep.h
@@ -1,7 +1,8 @@
1STATIC_INLINE bool get_visited(const uint8_t *, int64_t); 1STATIC_INLINE bool get_visited(const uint8_t *, int64_t);
2STATIC_INLINE void set_visited(uint8_t *, int64_t); 2STATIC_INLINE void set_visited(uint8_t *, int64_t);
3 3
4STATIC size_t gendata_cocsep(void *, uint64_t *, cube_t *); 4STATIC size_t gendata_cocsep(
5 char [static COCSEP_FULLSIZE+INFOSIZE], uint64_t *, cube_t *);
5STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t *); 6STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t *);
6STATIC void getdistribution_cocsep(const uint32_t *, uint64_t [static 21]); 7STATIC void getdistribution_cocsep(const uint32_t *, uint64_t [static 21]);
7 8
@@ -19,7 +20,11 @@ After the data as described above, more auxiliary information is appended:
19 of positions having that pruning value. 20 of positions having that pruning value.
20*/ 21*/
21STATIC size_t 22STATIC size_t
22gendata_cocsep(void *buf, uint64_t *selfsim, cube_t *rep) 23gendata_cocsep(
24 char buf[static COCSEP_FULLSIZE+INFOSIZE],
25 uint64_t *selfsim,
26 cube_t *rep
27)
23{ 28{
24 uint32_t *buf32, cc; 29 uint32_t *buf32, cc;
25 uint16_t n; 30 uint16_t n;
@@ -64,7 +69,7 @@ gendata_cocsep(void *buf, uint64_t *selfsim, cube_t *rep)
64 info.distribution[i] = cc; 69 info.distribution[i] = cc;
65 } 70 }
66 71
67 writetableinfo(&info, buf); 72 writetableinfo(&info, COCSEP_FULLSIZE+INFOSIZE, buf);
68 73
69 DBG_ASSERT(n == COCSEP_CLASSES, 0, 74 DBG_ASSERT(n == COCSEP_CLASSES, 0,
70 "cocsep: computed %" PRIu16 " symmetry classes, " 75 "cocsep: computed %" PRIu16 " symmetry classes, "

Generated with cgit - Back to sebastiano.tronto.net