Skip to content
Snippets Groups Projects
Commit f61edd03 authored by David Bühler's avatar David Bühler
Browse files

Merge branch 'fix/libc/getline-stub' into 'master'

[libc] improve stub for getline()

See merge request frama-c/frama-c!4300
parents 75880155 1e8e4fe7
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream) { ...@@ -71,7 +71,7 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
} }
if (!*lineptr || *n == 0) { if (!*lineptr || *n == 0) {
*lineptr = malloc(2); *lineptr = malloc(2);
if (!lineptr) { if (!*lineptr) {
errno = ENOMEM; errno = ENOMEM;
//TODO: set error indicator for stream //TODO: set error indicator for stream
return -1; return -1;
......
...@@ -6594,7 +6594,7 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream) ...@@ -6594,7 +6594,7 @@ ssize_t getline(char **lineptr, size_t *n, FILE *stream)
_LOR_1: _LOR_1:
{ {
*lineptr = (char *)malloc((size_t)2); *lineptr = (char *)malloc((size_t)2);
if (! lineptr) { if (! *lineptr) {
__fc_errno = 12; __fc_errno = 12;
__retres = -1; __retres = -1;
goto return_label; goto return_label;
......
...@@ -64,9 +64,6 @@ ...@@ -64,9 +64,6 @@
[eva] Done for function Frama_C_unsigned_char_interval [eva] Done for function Frama_C_unsigned_char_interval
[eva] Recording results for fgetc [eva] Recording results for fgetc
[eva] Done for function fgetc [eva] Done for function fgetc
[eva:alarm] FRAMAC_SHARE/libc/stdio.c:90: Warning:
out of bounds write. assert \valid(*lineptr + tmp_2);
(tmp_2 from cur++)
[eva] FRAMAC_SHARE/libc/stdio.c:83: starting to merge loop iterations [eva] FRAMAC_SHARE/libc/stdio.c:83: starting to merge loop iterations
[eva] FRAMAC_SHARE/libc/stdio.c:84: Reusing old results for call to fgetc [eva] FRAMAC_SHARE/libc/stdio.c:84: Reusing old results for call to fgetc
[eva] FRAMAC_SHARE/libc/stdio.c:104: Call to builtin realloc [eva] FRAMAC_SHARE/libc/stdio.c:104: Call to builtin realloc
...@@ -90,6 +87,9 @@ ...@@ -90,6 +87,9 @@
Called from FRAMAC_SHARE/libc/stdio.c:82. Called from FRAMAC_SHARE/libc/stdio.c:82.
[eva] Done for function feof [eva] Done for function feof
[eva] FRAMAC_SHARE/libc/stdio.c:84: Reusing old results for call to fgetc [eva] FRAMAC_SHARE/libc/stdio.c:84: Reusing old results for call to fgetc
[eva:alarm] FRAMAC_SHARE/libc/stdio.c:90: Warning:
out of bounds write. assert \valid(*lineptr + tmp_2);
(tmp_2 from cur++)
[eva] FRAMAC_SHARE/libc/stdio.c:84: Reusing old results for call to fgetc [eva] FRAMAC_SHARE/libc/stdio.c:84: Reusing old results for call to fgetc
[eva] FRAMAC_SHARE/libc/stdio.c:104: Call to builtin realloc [eva] FRAMAC_SHARE/libc/stdio.c:104: Call to builtin realloc
[eva] computing for function ferror <- getline <- main. [eva] computing for function ferror <- getline <- main.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment