Bienvenue invité ( Connexion | Inscription )
4 Oct 2006, 22:16
Message
#1
|
|
|
Adepte de Macbidouille ![]() Groupe : Membres Messages : 121 Inscrit : 2 Jan 2003 Lieu : Moselle - Metz Membre no 5 405 |
Bonsoir,
j'utilise depuis peu mon imac pour compiler des sources C pour différents tp ... les exemples de base, boucles etc ... marchent très bien mais je rencontre un souci avec un petit programme qui est sensé lire puis restituer un fichier sur l'ecran du shell J'obtiens le message suivant : Bus error .... voici ci dessous la source du programme, si quelqu'un pourrait m'éclairer un peu sur ce problème ? CODE #include <stdio.h>
int main() { FILE *f; char c; char saisie; printf("saisissez le fichier a lire"); scanf("%c", &saisie); f=fopen("saisie", "r"); while (! feof(f)) { c=fgetc(f); printf("%c", c); } } "lecture.c" 21L, 211C Ce message a été modifié par mackintosh - 4 Oct 2006, 22:17. -------------------- Rien ne sert de courir si l'on est pas sur le bon chemin.
|
|
|
|
![]() |
12 Oct 2006, 12:26
Message
#2
|
|
![]() Macbidouilleur d'Or ! ![]() ![]() ![]() ![]() ![]() Groupe : Membres Messages : 3 129 Inscrit : 21 Aug 2005 Membre no 44 239 |
CITATION a moins que tu sois dans un environnement embarqué ou militaire, on n'est plus au temps du Dos. Et même dans l'embarqué spatial/militaire, on n'est pas à l'abri de quelques erreurs, comme sur Ariane 501. Je sais que beaucoup d'entre vous connaissent l'histoire, mais elle est toujours intéressante à rappeler: CITATION In the failure scenario, the primary technical causes are the Operand Error when converting the horizontal bias variable BH, and the lack of protection of this conversion which caused the SRI computer to stop. It has been stated to the Board that not all the conversions were protected because a maximum workload target of 80% had been set for the SRI computer. To determine the vulnerability of unprotected code, an analysis was performed on every operation which could give rise to an exception, including an Operand Error. In particular, the conversion of floating point values to integers was analysed and operations involving seven variables were at risk of leading to an Operand Error. This led to protection being added to four of the variables, evidence of which appears in the Ada code. However, three of the variables were left unprotected. No reference to justification of this decision was found directly in the source code. Given the large amount of documentation associated with any industrial application, the assumption, although agreed, was essentially obscured, though not deliberately, from any external review. (SRI : Système de Référence Inertiel) Certaines conversions de valeurs n'étaient pas protégées contre un overflow, qui a provoqué une exception non controlée et l'arrêt du calculateur inertiel - ce dernier a par ailleurs envoyé un code d'erreur sur le bus de communication qui a été interprété comme des données par le calculateur principal. Bref, un bon gros micmac. Il s'est avéré que ces conversions n'étaient pas protégées parce que le profil de vol d'Ariane 4 ne pouvait pas générer de mesures inertielles assez grandes pour provoquer un overflow... mais sur Ariane 5, ce n'était plus le cas. -------------------- Powerbook G4 1.33 Ghz - Mac OS X 10.5
|
|
|
|
12 Oct 2006, 12:40
Message
#3
|
|
![]() Macbidouilleur de vermeil ! ![]() ![]() ![]() ![]() Groupe : Membres Messages : 1 484 Inscrit : 16 Nov 2005 Lieu : Metz Membre no 50 011 |
CITATION(Cochonou @ 12 Oct 2006, 13:26) [snapback]1928932[/snapback] CITATION a moins que tu sois dans un environnement embarqué ou militaire, on n'est plus au temps du Dos. Et même dans l'embarqué spatial/militaire, on n'est pas à l'abri de quelques erreurs, comme sur Ariane 501. Je sais que beaucoup d'entre vous connaissent l'histoire, mais elle est toujours intéressante à rappeler: CITATION In the failure scenario, the primary technical causes are the Operand Error when converting the horizontal bias variable BH, and the lack of protection of this conversion which caused the SRI computer to stop. It has been stated to the Board that not all the conversions were protected because a maximum workload target of 80% had been set for the SRI computer. To determine the vulnerability of unprotected code, an analysis was performed on every operation which could give rise to an exception, including an Operand Error. In particular, the conversion of floating point values to integers was analysed and operations involving seven variables were at risk of leading to an Operand Error. This led to protection being added to four of the variables, evidence of which appears in the Ada code. However, three of the variables were left unprotected. No reference to justification of this decision was found directly in the source code. Given the large amount of documentation associated with any industrial application, the assumption, although agreed, was essentially obscured, though not deliberately, from any external review. (SRI : Système de Référence Inertiel) Certaines conversions de valeurs n'étaient pas protégées contre un overflow, qui a provoqué une exception non controlée et l'arrêt du calculateur inertiel - ce dernier a par ailleurs envoyé un code d'erreur sur le bus de communication qui a été interprété comme des données par le calculateur principal. Bref, un bon gros micmac. Il s'est avéré que ces conversions n'étaient pas protégées parce que le profil de vol d'Ariane 4 ne pouvait pas générer de mesures inertielles assez grandes pour provoquer un overflow... mais sur Ariane 5, ce n'était plus le cas. Voilà une histoire intéressante. En fait, le crash est dû à une panne des systèmes informatiques de bord. La cause de cette panne fut la conversion d'un nombre flottant codé sur 64 bits en une valeur entière signée sur 16 bits provoquant une exception (le nombre flottant en question n'était pas représentable sur 16 bits). Mais la cause réelle résulte bien d'une spicification insuffisante puisque la valeur était représentable sur 16 bits pour Ariane 4. La précondition qui aurait sauvé Ariane 5 : CODE require horizontal_bias <= Maximum_horizontal_bias .En fait, tout ceci pour dire que réutiliser du code en l'abseence de contrat est une folie !! Bref, vos petites histoire de malloc -------------------- Mac Mini Late 2012 Core i7 2,6 GHz, 16 Go RAM, disque dur Fusion Drive 1 To, Mac OS Mojave 10.14.6, Western Digital Red 2 To dans un dock Storeva DriveDock U3 USB 3.0 pour Time Machine
Les jeux-vidéo, c'est comme l'amour. Le plaisir solitaire c'est bien, mais à deux c'est mieux |
|
|
|
mackintosh Bus Error en C 4 Oct 2006, 22:16
Cochonou Salut,
à vue d'oeil, tu alloues des char (c e... 4 Oct 2006, 22:20
schlum Yeah ! Buffer overflow
Le truc qui est ador... 4 Oct 2006, 22:27
mackintosh un Bus Error correspondrait donc à un BufferOverf... 4 Oct 2006, 22:32
Cochonou Normalement, quand tu accèdes à une zone mémoir... 4 Oct 2006, 23:04
mackintosh J'ai testé les solutions, à priori c'est... 5 Oct 2006, 16:20
mpergand http://www.lri.fr/~aze/page_c/aide_c/scanf.html 5 Oct 2006, 16:28
schlum 1 - scanf %c c'est pour récupérer 1 caractè... 5 Oct 2006, 17:09
mackintosh En effet çà fait pas mal de choses qui peuvent p... 5 Oct 2006, 17:31
Doom Hammer Le programme crash (probablement sur feof ou fgetc... 5 Oct 2006, 17:38
Cochonou Doom Hammer a certainement raison, parce qu'un... 5 Oct 2006, 21:23
mackintosh au final c'était tout simplement un problème... 6 Oct 2006, 20:35
schlum CITATION(mackintosh @ 6 Oct 2006, 21:35) ... 6 Oct 2006, 20:54
franklinchef Petite rectification pour tout le monde:
Bus erro... 9 Oct 2006, 21:12
noop CITATION(franklinchef @ 9 Oct 2006, 22:12... 10 Oct 2006, 10:07

franklinchef CITATION(noop @ 10 Oct 2006, 05:07) 19256... 10 Oct 2006, 13:42

noop CITATION(franklinchef @ 10 Oct 2006, 14:4... 10 Oct 2006, 13:49

franklinchef CITATION(noop @ 10 Oct 2006, 08:49) 19259... 10 Oct 2006, 14:43

noop CITATION(franklinchef @ 10 Oct 2006, 15:4... 10 Oct 2006, 14:54

chombier CITATION(noop @ 10 Oct 2006, 15:54) 19259... 10 Oct 2006, 16:01

noop CITATION(chombier @ 10 Oct 2006, 17:01) 1... 10 Oct 2006, 16:09

chombier CITATION(noop @ 10 Oct 2006, 17:09) 19261... 10 Oct 2006, 16:32

noop CITATION(chombier @ 10 Oct 2006, 17:32) 1... 11 Oct 2006, 09:14

chombier CITATION(noop @ 11 Oct 2006, 10:14) 19270... 11 Oct 2006, 09:48

noop CITATION(chombier @ 11 Oct 2006, 10:48) 1... 11 Oct 2006, 10:29
mackintosh CITATION(franklinchef @ 9 Oct 2006, 22:12... 12 Oct 2006, 19:01
chombier CITATION(mackintosh @ 12 Oct 2006, 20:01)... 12 Oct 2006, 19:20
schlum Vous exagérez quand même
Dans les sources de ... 11 Oct 2006, 10:44
chombier Et ? emacs est sensé être LA référence en mati... 11 Oct 2006, 10:46
noop CITATION(chombier @ 11 Oct 2006, 11:46) 1... 11 Oct 2006, 11:09
mpergand CITATION(noop @ 11 Oct 2006, 12:09) 19272... 11 Oct 2006, 13:10
schlum Avec "kmalloc", il vaut mieux (sinon c... 11 Oct 2006, 10:55
chombier CITATION(schlum @ 11 Oct 2006, 11:55) 192... 11 Oct 2006, 11:15
noop CITATION(Fotz @ 12 Oct 2006, 13:40) 19289... 12 Oct 2006, 12:52
mackintosh Je vois que le sujet a suscité beaucoup de réact... 12 Oct 2006, 15:40
noop CITATION(mackintosh @ 12 Oct 2006, 16:40)... 12 Oct 2006, 15:45
schlum CODESECURITY CONSIDERATIONS
The gets() f... 12 Oct 2006, 19:21
mackintosh D'accord je comprends mieux maintenant !
m... 12 Oct 2006, 19:30![]() ![]() |
| Nous sommes le : 3rd April 2026 - 15:21 |