Closed VasilievSerg closed 1 year ago
Thank you. The DataStoreEvent will probably be removed (as this entire functionality currently does not have any users that I know of), the setInitialMeans is dead code, so I fixed this by removing the function.
I've created POC for a few suspicious code fragments found by the PVS-Studio static code analyzer. They're below.
Issue 1 Two parameters of the
DataStoreEvent
constructor are not used. As a result, the object state after initialization is incorrect.Code:
Link to the sources.
POC
``` var inserts = DBIDUtil.newHashSet(32); var removals = DBIDUtil.newHashSet(64); var updates = DBIDUtil.newHashSet(128); var dataStoreEvent = new DataStoreEvent(inserts, removals, updates); // True: inserts.equals(dataStoreEvent.getInserts()); // False: removals.equals(dataStoreEvent.getRemovals()); // False: updates.equals(dataStoreEvent.getUpdates()); ```Issue 2 The
setInitialMeans
method recurses infinitely.Code:
Link to the sources.
POC
``` var predef = new Predefined(new double[3][3]); var arrList = new ArrayListP.S. Here is an old article describing more suspicions code fragments. I'm not sure that all described warnings are still actual. Anyway, perhaps the article may be useful to you.