File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -115,9 +115,19 @@ public ElfFile(MemoryStream input) : base(input)
115115 LibLogger . VerboseNewline ( "\t Processing Symbols..." ) ;
116116 start = DateTime . Now ;
117117
118- ProcessSymbols ( ) ;
118+ try
119+ {
120+ ProcessSymbols ( ) ;
119121
120- LibLogger . VerboseNewline ( $ "\t OK ({ ( DateTime . Now - start ) . TotalMilliseconds } ms)") ;
122+ LibLogger . VerboseNewline ( $ "\t OK ({ ( DateTime . Now - start ) . TotalMilliseconds } ms)") ;
123+ }
124+ catch ( Exception e )
125+ {
126+ LibLogger . ErrorNewline ( $ "\t Caught { e . GetType ( ) . Name } processing symbols! Attempting to continue without symbol information (no exports, for example)...") ;
127+ #if DEBUG
128+ LibLogger . ErrorNewline ( e . ToString ( ) ) ;
129+ #endif
130+ }
121131
122132 LibLogger . Verbose ( "\t Processing Initializers..." ) ;
123133 start = DateTime . Now ;
@@ -397,7 +407,12 @@ private void ProcessSymbols()
397407 {
398408 if ( GetDynamicEntryOfType ( ElfDynamicType . DT_SYMTAB ) is { } dynamicSymTab )
399409 {
400- var end = _dynamicSection . Where ( x => x . Value > dynamicSymTab . Value ) . OrderBy ( x => x . Value ) . First ( ) . Value ;
410+ var endSection = _dynamicSection . Where ( x => x . Value > dynamicSymTab . Value ) . OrderBy ( x => x . Value ) . FirstOrDefault ( ) ;
411+ ulong end ;
412+ if ( endSection != null )
413+ end = endSection . Value ;
414+ else
415+ end = GetProgramHeaderOfType ( ElfProgramEntryType . PT_DYNAMIC ) is { } dynamicSegment ? dynamicSegment . VirtualAddress + dynamicSegment . RawSize : ( ulong ) RawLength ;
401416 var dynSymSize = is32Bit ? 18ul : 24ul ;
402417
403418 var address = ( ulong ) MapVirtualAddressToRaw ( dynamicSymTab . Value ) ;
You can’t perform that action at this time.
0 commit comments