Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005761OCamlOCaml otherlibspublic2012-09-18 21:122013-06-14 22:19
Reportervouillon 
Assigned Toxleroy 
PriorityhighSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSMac OS XOS Version
Product Version4.00.0 
Target Version4.00.1+devFixed in Version4.00.1+dev 
Summary0005761: Incorrect bigarray custom block size
DescriptionThe fix to issue 0005516 introduced a bug.

The size of bigarray custom blocks is computed as follows:

   sizeof(struct caml_ba_array) + (num_dims - 1) * sizeof(intnat)

(in functions caml_ba_alloc and caml_ba_deserialize).

This is too small by one when a C99's flexible array type is used:

   #if (__STDC_VERSION__ >= 199901L)
   intnat dim[] /*[num_dims]*/; /* Size in each dimension */
   #else
   intnat dim[1] /*[num_dims]*/; /* Size in each dimension */
   #endif
TagsNo tags attached.
Attached Filestxt file icon patch.txt [^] (1,130 bytes) 2012-09-19 10:34 [Show Content]

- Relationships
related to 0005516resolved "struct hack" for bigarrays clashes with clang array bounds checks 

-  Notes
(0008107)
vouillon (reporter)
2012-09-19 10:37

In fact, only serialization is affected. I have uploaded a fix.

But maybe we should use offsetof rather than conditional directives?

  offsetof(struct caml_ba_array, dim) + num_dims * sizeof(intnat)
(0008172)
doligez (administrator)
2012-09-27 17:57
edited on: 2012-09-27 17:59

patch applied in 4.00.1+dev (r 12963) and trunk (r 12964)

Left as "resolved" (instead of closed) because Xavier wants to do some refactoring on this code.

(0008216)
xleroy (administrator)
2012-10-07 08:55

Refactoring of this code in the trunk, commit 12993.

- Issue History
Date Modified Username Field Change
2012-09-18 21:12 vouillon New Issue
2012-09-19 10:34 vouillon File Added: patch.txt
2012-09-19 10:37 vouillon Note Added: 0008107
2012-09-27 16:36 xleroy Status new => acknowledged
2012-09-27 16:36 xleroy Target Version => 4.00.1+dev
2012-09-27 17:57 doligez Note Added: 0008172
2012-09-27 17:57 doligez Assigned To => xleroy
2012-09-27 17:57 doligez Status acknowledged => resolved
2012-09-27 17:57 doligez Resolution open => fixed
2012-09-27 17:57 doligez Relationship added related to 0005516
2012-09-27 17:59 doligez Note Edited: 0008172 View Revisions
2012-10-07 08:55 xleroy Note Added: 0008216
2012-10-07 08:55 xleroy Fixed in Version => 4.00.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker