MantisBT - Open CASCADE
View Issue Details
0025275Open CASCADE[OCCT] OCCT:Data Exchangepublic2014-09-26 09:532015-05-14 15:32
[OCCT] 6.9.0[OCCT] 6.9.0 
Not needed
0025275: Different result of reading operation from *.igs and *.stp file for WINDOWS and LINUX platforms
For example, there is the file UKI60107-6.igs in OCCT Base with following structure.

Useful data are in line-range from 1 to 11092 (see file_content.png attached picture). Next lines contain not actual data. [In the picture file is showed with unprinted symbols, such as LF (ASCII-code 0x0A), SUB (ASCII-code 0x1A), BEL (ASCII-code 0x07) etc.]

WINDOWS reads only (!) these 1092 lines, after that it breaks to read in reason of meeting end of file.

LINUX continues reading. It results in this error:
"1 F: Syntax error in IGES file at line 11093 in section T."

(see test de iges_3 A3 in DEBUG mode on LINUX platform). On WINDOWS platform these errors are absent.
test de iges_3 A3

New test case is not required.
Just for the record:
According to information from here ( [^]), symbol SUB (ASCII-code 0x1A) is used for substituting lost or entering with mistake symbol. Now it is interpreted by DOS and WINDOWS (LINUX is not in this list) system as END OF FILE. Therefore, LINUX does not break reading.
No tags attached.
related to 0023547closed abv Open CASCADE Tests failures in debug mode 
related to 0025602assigned skl Open CASCADE Data Exchange - It is important for IGES and STEP file format to add check, if wrong data are read from the file 
png file_content.PNG (35,317) 2014-09-26 09:53
Issue History
2014-09-26 09:53nbvNew Issue
2014-09-26 09:53nbvAssigned To => nbv
2014-09-26 09:53nbvFile Added: file_content.PNG
2014-09-26 09:58abvTarget Version => 7.1.0
2014-09-26 11:04nbvRelationship addedrelated to 0023547
2014-10-01 12:44nbvNote Added: 0032501
2014-10-20 14:19gitNote Added: 0033332
2014-12-04 11:04gitNote Added: 0034995
2014-12-08 16:12gitNote Added: 0035141
2014-12-08 17:09gitNote Added: 0035147
2014-12-09 10:41gitNote Added: 0035187
2014-12-09 10:51gitNote Added: 0035188
2014-12-09 11:25gitNote Added: 0035192
2014-12-09 13:33nbvDescription Updatedbug_revision_view_page.php?rev_id=8798#r8798
2014-12-09 13:33nbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=8800#r8800
2014-12-09 13:33nbvAdditional Information Updatedbug_revision_view_page.php?rev_id=8802#r8802
2014-12-09 13:34nbvDescription Updatedbug_revision_view_page.php?rev_id=8803#r8803
2014-12-09 13:34nbvFile Added: wrongnum.PNG
2014-12-09 13:35nbvDescription Updatedbug_revision_view_page.php?rev_id=8804#r8804
2014-12-09 13:36nbvFile Deleted: wrongnum.PNG
2014-12-09 13:37nbvFile Added: wrongnum.PNG
2014-12-09 13:40nbvAdditional Information Updatedbug_revision_view_page.php?rev_id=8805#r8805
2014-12-09 13:42nbvStatusnew => assigned
2014-12-09 14:13nbvNote Added: 0035207
2014-12-09 14:15nbvAssigned Tonbv => ifv
2014-12-09 14:15nbvStatusassigned => resolved
2014-12-09 14:15nbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=8806#r8806
2014-12-10 10:41nbvAssigned Toifv => msv
2014-12-10 10:41nbvNote Edited: 0035207bug_revision_view_page.php?bugnote_id=35207#r8820
2014-12-10 21:49msvNote Added: 0035288
2014-12-10 21:49msvAssigned Tomsv => nbv
2014-12-10 21:49msvStatusresolved => assigned
2014-12-10 21:58abvNote Added: 0035289
2014-12-10 22:44msvNote Added: 0035290
2014-12-11 09:18kgvSummaryDiferent result of reading operation from *.igs and *.stp file for WINDOWS and LINUX platform => Different result of reading operation from *.igs and *.stp file for WINDOWS and LINUX platforms
2014-12-11 09:42nbvNote Added: 0035296
2014-12-11 09:50msvNote Added: 0035297
2014-12-11 10:02nbvNote Added: 0035298
2014-12-11 10:09msvNote Added: 0035299
2014-12-11 11:13nbvNote Added: 0035304
2014-12-11 11:13nbvNote Edited: 0035304bug_revision_view_page.php?bugnote_id=35304#r8841
2014-12-11 11:42msvNote Added: 0035310
2014-12-11 11:47nbvNote Added: 0035311
2014-12-12 16:30nbvFile Deleted: wrongnum.PNG
2014-12-12 16:31nbvDescription Updatedbug_revision_view_page.php?rev_id=8863#r8863
2014-12-12 16:31nbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=8864#r8864
2014-12-12 16:31nbvAdditional Information Updatedbug_revision_view_page.php?rev_id=8865#r8865
2014-12-12 16:32nbvRelationship addedrelated to 0025602
2014-12-12 16:48gitNote Added: 0035373
2014-12-12 16:51nbvNote Added: 0035374
2014-12-12 16:51nbvAssigned Tonbv => msv
2014-12-12 16:51nbvStatusassigned => resolved
2014-12-13 16:39msvNote Added: 0035394
2014-12-13 16:39msvAssigned Tomsv => bugmaster
2014-12-13 16:39msvStatusresolved => reviewed
2014-12-16 15:55mkvAssigned Tobugmaster => apv
2014-12-17 12:43gitNote Added: 0035451
2014-12-17 12:43apvNote Added: 0035452
2014-12-18 17:50apvNote Added: 0035487
2014-12-18 17:50apvAssigned Toapv => nbv
2014-12-18 17:50apvStatusreviewed => assigned
2014-12-18 17:57apvNote Edited: 0035487bug_revision_view_page.php?bugnote_id=35487#r8914
2014-12-18 18:04nbvNote Added: 0035488
2014-12-18 18:04nbvAssigned Tonbv => apv
2014-12-18 18:04nbvStatusassigned => feedback
2014-12-18 18:09apvNote Added: 0035489
2014-12-18 18:09apvAssigned Toapv => bugmaster
2014-12-18 18:09apvStatusfeedback => tested
2014-12-18 18:10apvTest case number => Not needed
2014-12-26 13:33bugmasterChangeset attached => occt master 22835705
2014-12-26 13:33bugmasterStatustested => verified
2014-12-26 13:33bugmasterResolutionopen => fixed
2015-01-12 13:59abvRelationship addedrelated to 0025486
2015-01-19 16:23bugmasterTarget Version7.1.0 => 6.9.0
2015-01-26 12:34gitNote Added: 0036565
2015-05-14 15:29aivStatusverified => closed
2015-05-14 15:32aivFixed in Version => 6.9.0

2014-10-01 12:44   
Small remark!

This problem is actual for *.igs file. In *.stp-file range of correct data is well-defined thanks to file-structure (for example, useful data are contained between "ISO-10303-21" and "END-ISO-10303-21" tags).
2014-10-20 14:19   
Branch CR25275 has been created by nbv.

SHA-1: 39caea0e17f6a0e746fc5d6f46df2c4fd0127261

Detailed log of new commits:

Author: nbv
Date: Fri Oct 17 15:45:19 2014 +0400


Author: nbv
Date: Fri Oct 17 13:32:21 2014 +0400


Author: nbv
Date: Mon Oct 13 17:36:20 2014 +0400

    Illegal number processing.

Author: nbv
Date: Tue Sep 30 12:51:38 2014 +0400

    Catch illegal numbers.

Author: nbv
Date: Tue Sep 30 09:44:28 2014 +0400

    0025275: Diferent result of reading operation from *.igs and *.stp file for WINDOWS and LINUX platform
    Symbol SUB (ASCII-code 0x1A) should be considered as End-Of-File both on WINDOWS and LINUX (and on other) system.
2014-12-04 11:04   
Branch CR25275 has been updated forcibly by nbv.

SHA-1: d38b92391a9f8c9a42eb55a14af0ef4e8d541ca9
2014-12-08 16:12   
Branch CR25275 has been updated forcibly by nbv.

SHA-1: 2fbaa8957aef6513d05359d47c8963c1bfc4abd1
2014-12-08 17:09   
Branch CR25275 has been updated forcibly by nbv.

SHA-1: 4808274acd903bee6df7c81370a6f7fcdbf267b0
2014-12-09 10:41   
Branch CR25275 has been updated forcibly by nbv.

SHA-1: f7eba5cc4e92a9fa326622fc402f2878bbfbe444
2014-12-09 10:51   
Branch CR25275 has been updated forcibly by nbv.

SHA-1: 8bc7ff98987cdba9f47ea182cb8b57f2bc0686ac
2014-12-09 11:25   
Branch CR25275 has been updated forcibly by nbv.

SHA-1: f622599e67d70b01d92f6d3d111d55623d4bdcb8
2014-12-09 14:13   
(edited on: 2014-12-10 10:41)
Dear Mikhail!

Please review branch CR25275.

2014-12-10 21:49   

Class Precision.
- The macro DEFINE_STANDARD_ALLOC is extra for the class containing only static methods.
- Please remove obsolete code in "#ifdef PRECISION_OBSOLETE"
- Do not use Standard_EXPORT keyword for inline methods.
- The method IsIllegal is too complex to be inline.
- The method IsInfinitesimal will return true for zero argument. It is wrong by definition.

Package Standard
- It is questionable adding new exception of type Standard_FloatingPointOverflow. First, it must inherit Standard_NumericError rather than Standard_Failure. Second, There is already Standard_Overflow exception. Moreover, taking into account the contexts, in which this new exception is raised I would name it Standard_IllegalNumber, again inheriting Standard_NumericError.

- The lines 157-165 must be placed inside the scope of condition of line 154:
      if ( i == 13 || i == 17 || i == 19 || i == 20)

- The lines 543-552 have wrong indentation. Please take into account that where tab characters are used there tab length is assumed to be 8 characters.

General remark. I would like to know where exception about illegal number is caught during step/iges reading. What will be the result of reading such file?
2014-12-10 21:58   
Nikolai, please describe what has been done in your fix. The issue description refers to problem with symbol SUB which, in my own experience, unavoidably breaks reading of the file on Windows. Have you been able to cope with that? Or you made some changes completely irrelevant to this problem (as I guess from Mikhail remarks)?
2014-12-10 22:44   
Andrey, Nikolay did two fixes in one. He addressed the SUB symbol as well, stopping reading the file in this case.
2014-12-11 09:42   
Dear Andrey!

Bug description was extended:
"Additionally, it is important for IGES and STEP file format to add check, if if wrong data are read from the file. For example, if file contains number ~ 1.0e-314 (less than DBL_MIN) or Nan-numbers (see wrongnum.PNG file attached)."

However, it is not the reason for different result for WINDOWS and LINUX platforms. Therefore, we are discussing with Mikhail: "Should we divide this issue on two separately parts (create new bug about wrong numbers reading or keep full script in this issue)?"
2014-12-11 09:50   
Nikolay, one thing is unclear for me. Why you in steps to reproduce added the line:
test de step_1 E6
I looked at that step file, and it does not contain any unprintable symbols. Is this file also read differently on windows and linux?
2014-12-11 10:02   
Test "de iges_3 A3" contains unprintable symbol SUB (ASCII-code 0x1A). For *.stp-file this problem is not actual (see above).

Test "de step_1 E6" uses file, fragment of which is in attached picture "wrongnum.PNG". Therefore, this test must be in Steps To Reproduce.
2014-12-11 10:09   
What is wrong when reading bad numbers? Do you observe different behavior on windows and linux? Or is there any floating point exception? Why is it necessary to take care of illegal numbers?
In any case, I would like to separate these two problems in different bugs and solved them separately.
2014-12-11 11:13   
"What is wrong when reading bad numbers?"

Sometimes it is not wrong. But it is possible for computations to use these data. For example, when computing value of (X^2)*f(X) (in Newton method), where X is 1.0e+109 => f(X) ~ 1.0e+100. Then (X^2)*f(X) ~ 1.0e+318 > DBL_MAX. Earlier, when OCCT Catch Signals was ON, this fact will result of the exception. Now, this situation is not controlled. There is no point in improving OCCT computational methods for processing these cases, if these wrong numbers are source data.

"Do you observe different behavior on windows and linux?"

See [^] " is not the reason for different result for WINDOWS and LINUX platforms."

2014-12-11 11:42   
Nikolay, concluding the above discussion, I suggest that you create a new bug for treating illegal numbers during files import, and leave in the current fix only the code relevant to the subject of this bug.
2014-12-11 11:47   
OK! Thank you so much.
2014-12-12 16:48   
Branch CR25275 has been updated forcibly by nbv.

SHA-1: 53d2b99c47a63de45bbf2f48f134bae6453486ca
2014-12-12 16:51   
Dear Mikhail!

Please review CR25275 branch. Principle changes are in lines #87+
2014-12-13 16:39   
2014-12-17 12:43   
Branch CR25275 has been updated forcibly by apv.

SHA-1: a523225468e75aaceccd9ada82a123c014737487
2014-12-17 12:43   
Branch CR25275 has been rebased on the current master
2014-12-18 17:50   
(edited on: 2014-12-18 17:57)
Dear BugMaster,

Branch CR25275 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: a523225468e75aaceccd9ada82a123c014737487

Number of compiler warnings:
occt component:
   Linux: 18 (18 on master)
   Windows: 0 (0 on master)
products component :
   Linux: 11 (11 on master)
   Windows: 1 (1 on master)

http://occt-tests/CR25275-master-products/Debian60-64/summary.html [^]
http://occt-tests/CR25275-master-products/Windows-32-VC10/summary.html [^]
cr standard(001) E1

Testing on Linux:
Total MEMORY difference: 367181040 / 367862128
Total CPU difference: 48660.6899999999 / 51444.81000000015

Testing on Windows:
Total MEMORY difference: 277906444 / 277277864
Total CPU difference: 46918.0 / 37472.0935757

2014-12-18 18:04   
Dear Alexei!

Please recheck regression tests.
2014-12-18 18:09   
Test-case cr standard(001) E1 is unstable on current master.
2015-01-26 12:34   
Branch CR25275 has been deleted by inv.

SHA-1: a523225468e75aaceccd9ada82a123c014737487