planetarium/rocksdb-sharp

RocksDb.ctor() occurs if path parameter is null

Aperta

#3 aperta il 27 gen 2021

 (0 commenti) (0 reazioni) (0 assegnatari)C# (3 fork)auto 404
buggood first issue

Metriche repository

Star
 (4 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

When calling RocksDb's constructor with with null path parameter, it occurs System.AccessViolationException.

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at RocksDbSharp.Native.rocksdb_open(IntPtr, System.String)
   at RocksDbSharp.RocksDb.Open(RocksDbSharp.OptionsHandle, System.String)
   at RocksDBTool.Program+<Main>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at RocksDBTool.Program.Main(System.String[])
   at RocksDBTool.Program.<Main>(System.String[])

It should check it is null and throw System.ArgumentNullException. https://github.com/planetarium/rocksdb-sharp/blob/ccaf2184464963b565f7cfb9627cdf4734434af6/RocksDbSharp/RocksDb.cs#L42-L46

Guida contributor