diff --git a/w3lib/html.py b/w3lib/html.py
index a31d42b..0cff2ff 100644
--- a/w3lib/html.py
+++ b/w3lib/html.py
@@ -91,7 +91,7 @@ def replace_entities(
                     return bytes((number,)).decode("cp1252")
                 else:
                     return chr(number)
-            except ValueError:
+            except (ValueError, OverflowError):
                 pass
 
         return "" if remove_illegal and groups.get("semicolon") else m.group(0)

diff --git a/tests/test_html.py b/tests/test_html.py
index 1e637b0..1cabf6d 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -65,6 +65,10 @@ class RemoveEntitiesTest(unittest.TestCase):
         self.assertEqual(replace_entities("x&#x2264;y"), "x\u2264y")
         self.assertEqual(replace_entities("x&#157;y"), "xy")
         self.assertEqual(replace_entities("x&#157;y", remove_illegal=False), "x&#157;y")
+        self.assertEqual(replace_entities("&#82179209091;"), "")
+        self.assertEqual(
+            replace_entities("&#82179209091;", remove_illegal=False), "&#82179209091;"
+        )
 
     def test_browser_hack(self):
         # check browser hack for numeric character references in the 80-9F range

Function `convert_entity` does not catch `OverflowError` 
Error:
```
OverflowError
Python int too large to convert to C int
```

`w3lib` version -> `2.0.1`
`Python` version -> `3.8.13`

<img width="1131" alt="Screenshot 2022-10-31 at 10 02 22" src="https://user-images.githubusercontent.com/107861298/198971171-1af35f01-42d2-413a-8c47-9d2c3dc6ece1.png">

tests/test_html.py::RemoveEntitiesTest::test_illegal_entities
tests/test_html.py::RemoveEntitiesTest::test_browser_hack tests/test_html.py::RemoveEntitiesTest::test_encoding tests/test_html.py::RemoveEntitiesTest::test_keep_entities tests/test_html.py::RemoveEntitiesTest::test_missing_semicolon tests/test_html.py::RemoveEntitiesTest::test_regular tests/test_html.py::RemoveEntitiesTest::test_returns_unicode tests/test_html.py::ReplaceTagsTest::test_replace_tags tests/test_html.py::ReplaceTagsTest::test_replace_tags_multiline tests/test_html.py::ReplaceTagsTest::test_returns_unicode tests/test_html.py::RemoveCommentsTest::test_no_comments tests/test_html.py::RemoveCommentsTest::test_remove_comments tests/test_html.py::RemoveCommentsTest::test_returns_unicode tests/test_html.py::RemoveTagsTest::test_keep_argument tests/test_html.py::RemoveTagsTest::test_remove_empty_tags tests/test_html.py::RemoveTagsTest::test_remove_tags tests/test_html.py::RemoveTagsTest::test_remove_tags_with_attributes tests/test_html.py::RemoveTagsTest::test_remove_tags_without_tags tests/test_html.py::RemoveTagsTest::test_returns_unicode tests/test_html.py::RemoveTagsTest::test_uppercase_tags tests/test_html.py::RemoveTagsWithContentTest::test_empty_tags tests/test_html.py::RemoveTagsWithContentTest::test_returns_unicode tests/test_html.py::RemoveTagsWithContentTest::test_tags_with_shared_prefix tests/test_html.py::RemoveTagsWithContentTest::test_with_tags tests/test_html.py::RemoveTagsWithContentTest::test_without_tags tests/test_html.py::ReplaceEscapeCharsTest::test_returns_unicode tests/test_html.py::ReplaceEscapeCharsTest::test_with_escape_chars tests/test_html.py::ReplaceEscapeCharsTest::test_without_escape_chars tests/test_html.py::UnquoteMarkupTest::test_returns_unicode tests/test_html.py::UnquoteMarkupTest::test_unquote_markup tests/test_html.py::GetBaseUrlTest::test_attributes_before_href tests/test_html.py::GetBaseUrlTest::test_base_url_in_comment tests/test_html.py::GetBaseUrlTest::test_get_base_url tests/test_html.py::GetBaseUrlTest::test_get_base_url_latin1 tests/test_html.py::GetBaseUrlTest::test_get_base_url_latin1_percent tests/test_html.py::GetBaseUrlTest::test_get_base_url_utf8 tests/test_html.py::GetBaseUrlTest::test_no_scheme_url tests/test_html.py::GetBaseUrlTest::test_relative_url_with_absolute_path tests/test_html.py::GetBaseUrlTest::test_tag_name tests/test_html.py::GetMetaRefreshTest::test_commented_meta_refresh tests/test_html.py::GetMetaRefreshTest::test_entities_in_redirect_url tests/test_html.py::GetMetaRefreshTest::test_float_refresh_intervals tests/test_html.py::GetMetaRefreshTest::test_get_meta_refresh tests/test_html.py::GetMetaRefreshTest::test_html_comments_with_uncommented_meta_refresh tests/test_html.py::GetMetaRefreshTest::test_inside_noscript tests/test_html.py::GetMetaRefreshTest::test_inside_script tests/test_html.py::GetMetaRefreshTest::test_leading_newline_in_url tests/test_html.py::GetMetaRefreshTest::test_multiline tests/test_html.py::GetMetaRefreshTest::test_nonascii_url_latin1 tests/test_html.py::GetMetaRefreshTest::test_nonascii_url_latin1_query tests/test_html.py::GetMetaRefreshTest::test_nonascii_url_utf8 tests/test_html.py::GetMetaRefreshTest::test_redirections_in_different_ordering__in_meta_tag tests/test_html.py::GetMetaRefreshTest::test_relative_redirects tests/test_html.py::GetMetaRefreshTest::test_tag_name tests/test_html.py::GetMetaRefreshTest::test_without_url