Attributes of size 1 are rejected
ID0002432: **This issue was created automatically from Mantis Issue 2432. Further discussion may take place here.** --- | **Id** | **Project** | **Category** | **View** | **Due Date** | **Updated** | | --- | --- | --- | --- | --- | --- | | ID0002432 | Frama-C | Kernel | public | 2019-03-20 | 2019-07-05 | | | | | | | | | --- | --- | --- | --- | --- | --- | | **Reporter** | Stevendeo | **Assigned To** | virgile | **Resolution** | fixed | | **Priority** | low | **Severity** | minor | **Reproducibility** | always | | **Platform** | - | **OS** | - | **OS Version** | - | | **Product Version** | Frama-C 18-Argon | **Target Version** | - | **Fixed in Version** | Frama-C 19-Potassium | ### Description : Attributes are parsed by Extlib.strip_underscore that removes underscores before and after a string. However, the function always returns an empty string when the size of the input is 1. The attribute is then rejected. The error is not raised in Chlorine. ### Additional Information : Here is a possible bug fix let strip_underscore s = let l = String.length s in if l = 1 then match s with "_" -> "" | _ -> s else let rec start i = if i >= l then l-1 else if s.[i] = '_' then start (i + 1) else i in let st = start 0 in if st = l - 1 then "" else begin let rec finish i = (* We know that we will stop at >= st >= 0 *) if s.[i] = '_' then finish (i - 1) else i in let fin = finish (l - 1) in String.sub s st (fin - st + 1) end ### Steps To Reproduce : frama-c foo.c ## Attachments - [foo.c](/uploads/0db088be54173ea15dc321348fab0b1d/foo.c)
issue