Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix content scanner creating false positive playlist entries #8333

Merged
merged 1 commit into from
Feb 21, 2019
Merged

Fix content scanner creating false positive playlist entries #8333

merged 1 commit into from
Feb 21, 2019

Conversation

rlnilsen
Copy link
Contributor

Description

In the following circumstance the content scanner will add a false positive to a playlist:

  • The first item scanned is a zip archive with a file inside, neither of which have a crc match in a rdb.
  • The second item scanned is a zip archive which has a crc match in a rdb.
  • The third item scanned is the file inside the first item. This is because the third item is enqueued for later scanning when the first item fails the crc match.

This results in a playlist containg entries for the first and second items, even though the first item should not have been included.

The issue occurs because:

  1. The state variable archive_crc is not reset between the scanning of the second and the third item.
  2. When the third item's crc is looked up in the rdb, the second item's archive_crc is matched, which causes the false positive:
tasks/task_database.c:

lines 926-928:
      snprintf(query, sizeof(query),
            "{crc:or(b\"%08X\",b\"%08X\")}",
            db_state->crc, db_state->archive_crc);

lines 944-947:
         if (db_state->archive_crc == db_info_entry->crc32)
            return database_info_list_iterate_found_match(
                  _db,
                  db_state, db, NULL);

In addition, in the playlist, the false positive item wrongly gets the label and crc32 of the second item.

@inactive123 inactive123 merged commit 2cd8454 into libretro:master Feb 21, 2019
@i30817
Copy link
Contributor

i30817 commented Feb 22, 2019

might fix #6699

@rlnilsen
Copy link
Contributor Author

The playlist snippets shown in #6699 look exactly like what I saw, so I think @i30817 is right. I apologize for forgetting to look for related issues when posting this pull request!

@rlnilsen rlnilsen deleted the contentscannerfalsepositives branch March 1, 2019 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants