IndexFastScan::reset 会导致 ntotal2 过期,从而在搜索时产生 SIGSEGV
def find_root(): for parent in HERE.parents: if (parent / "VDBMS/faiss/faiss/IndexFastScan.cpp").is_file(): return parent raise RuntimeError("cannot locate checked-out VDBMSFuzz root")
def now(): return dt.datetime.now(dt.timezone.utc).replace(microsecond=0).isoformat()
def run_process(binary, mode, execution_dir): execution_dir.mkdir(parents=True, exist_ok=True) try: result = subprocess.run( [str(binary), mode], cwd=str(execution_dir), capture_output=True, text=True, timeout=30, check=False, ) return { "mode": mode, "returncode": result.returncode, "stdout": result.stdout, "stderr": result.stderr, "timed_out": False, "execution_dir": str(execution_dir), } except subprocess.TimeoutExpired as exc: return { "mode": mode, "returncode": None, "stdout": exc.stdout or "", "stderr": exc.stderr or "", "timed_out": True, "execution_dir": str(execution_dir), }
def write_json(path, value): path.write_text(json.dumps(value, indent=2, sort_keys=True) + "\n")
def main(): parser = argparse.ArgumentParser() parser.add_argument("--trials", type=int, default=10) args = parser.parse_args() if args.trials < 10: print("--trials must be at least 10", file=sys.stderr) return 2
内容来源: facebookresearch/faiss