File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
src/hyperlight_guest_bin/src Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -157,21 +157,15 @@ fn _panic_handler(info: &core::panic::PanicInfo) -> ! {
157157 let mut panic_buf_guard: MutexGuard < ' _ , FixedStringBuf < ' static > > = PANIC_BUF . lock ( ) ;
158158 let write_res = write ! ( panic_buf_guard, "{}" , info) ;
159159 if let Err ( _) = write_res {
160- // reset the buffer to ensure there is space
161- // for the new panic message below
162- panic_buf_guard. reset ( ) ;
163- panic ! ( "panic: message format failed" ) ;
160+ unsafe { abort_with_code_and_message ( & [ ErrorCode :: UnknownError as u8 ] , b"panic: message format failed\0 " . as_ptr ( ) as * const i8 ) }
164161 }
165162
166163 // create a CStr from the underlying array in PANIC_BUF using the as_cstr method.
167164 // this wraps CStr::from_bytes_until_nul which takes a borrowed byte slice
168165 // and does not allocate.
169166 let c_string_res = panic_buf_guard. as_c_str ( ) ;
170167 if let Err ( _) = c_string_res {
171- // reset the buffer here as well, to ensure there is space
172- // in the buffer to write the new panic message below.
173- panic_buf_guard. reset ( ) ;
174- panic ! ( "panic: failed to convert to CStr" ) ;
168+ unsafe { abort_with_code_and_message ( & [ ErrorCode :: UnknownError as u8 ] , b"panic: failed to convert to CStr\0 " . as_ptr ( ) as * const i8 ) }
175169 }
176170
177171 unsafe { abort_with_code_and_message ( & [ ErrorCode :: UnknownError as u8 ] , c_string_res. unwrap ( ) . as_ptr ( ) ) }
You can’t perform that action at this time.
0 commit comments