microsoft / infersharp

Infer# is an interprocedural and scalable static code analyzer for C#. Via the capabilities of Facebook's Infer, this tool detects null dereferences, resource leaks, and thread-safety violations. It also performs taint flow tracking to detect critical security vulnerabilities like SQL injections.
MIT License
727 stars 29 forks source link

Unable to translate Unicode character \\uDC00 #143

Closed MortenAanaes closed 1 year ago

MortenAanaes commented 2 years ago

Using infersharp 1.3, I got the following:

`InferSharp is analyzing: //mnt/e/projects/WorkProject Processing {//mnt/e/projects/WorkProject} Copying binaries to a staging folder...

Code translation started... Translation stage 1/3: Loading binaries. Translation stage 2/3: Computing type environment. Methods analyzed: ATranslation stage 3/3: Computing control-flow graph. Methods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: T Methods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: TMethods analyzed: T Coverage Statistics:

Method successfully translated: 309817 (90%) Method partially translated: 34265 (10%) Instructions translated: 5548111 (72%) Instructions skipped: 2140588 (28%)

ERROR: Unhandled exception: ERROR: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Text.EncoderFallbackException: Unable to translate Unicode character \uDC00 at index 767 to specified code page. at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index) at System.Text.EncoderFallbackBuffer.InternalFallback(ReadOnlySpan1 chars, Int32& charsConsumed) at System.Text.Encoding.GetBytesWithFallback(ReadOnlySpan1 chars, Int32 originalCharsLength, Span`1 bytes, Int32 originalBytesLength, EncoderNLS encoder) at System.Text.Encoding.GetBytesWithFallback(Char pOriginalChars, Int32 originalCharCount, Byte pOriginalBytes, Int32 originalByteCount, Int32 charsConsumedSoFar, Int32 bytesWrittenSoFar, EncoderNLS encoder) at System.Text.Encoding.GetBytes(Char pChars, Int32 charCount, Byte pBytes, Int32 byteCount, EncoderNLS encoder) at System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex, Boolean flush) at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.WriteAllText(String path, String contents) at Cilsil.Program.Translate(String[] paths, String outcfg, String cfgtxt, String outtenv, String dot, Boolean debug, Boolean extprogress) in /Cilsil/Program.cs:line 101 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Delegate.DynamicInvoke(Object[] args) at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>cDisplayClass2_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<b16_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>cDisplayClass8_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<b7_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<b6_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<b__14_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>cDisplayClass3_0.<b0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<b17_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<b__0>d.MoveNext() Code translation completed. Analyzing...

ERROR: Uncaught Internal Error: (Sys_error "/root/infersharp/infer-staging/tenv.json: No such file or directory") Error backtrace: Raised by primitive operation at Stdlib.open_in_gen in file "stdlib.ml", line 405, characters 28-54 Called from Stdlib.open_in in file "stdlib.ml" (inlined), line 410, characters 2-45 Called from Yojson.Safe.from_file in file "lib/read.mll" (inlined), line 1135, characters 13-25 Called from BackendInferAnalyzeJson.analyze_json in file "src/backend/InferAnalyzeJson.ml", line 709, characters 24-57 Called from IntegrationDriver.execute_analyze_json in file "src/integration/Driver.ml", line 200, characters 6-54 Called from IBaseUtils.timeit in file "src/base/Utils.ml", line 424, characters 16-20 Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 83, characters 29-44 Called from IntegrationDriver.analyze_and_report in file "src/integration/Driver.ml" (inlined), line 299, characters 2-144 Called from DuneexeInfer.run in file "src/infer.ml" (inlined), line 21, characters 2-47 Called from IBaseUtils.timeit in file "src/base/Utils.ml" (inlined), line 424, characters 16-20 Called from IBaseScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 83, characters 29-44 Called from DuneexeInfer.run in file "src/infer.ml", line 25, characters 22-94

Run the command again with --keep-going to try and ignore this error.`

matjin commented 2 years ago

Ah yes -- thank you for reporting this. This is a known issue and I am currently in the process of producing the fix -- will update this thread as soon as I've checked it in.

matjin commented 1 year ago

This issue should be fixed now.

MortenAanaes commented 1 year ago

I cannot reproduce in infersharp 1.4.