Skip to content

fix : replaced pickle.load with json and used context managers in Word-Building data.py - #1846

Closed
tmdeveloper007 wants to merge 1 commit into
steam-bell-92:mainfrom
tmdeveloper007:#1841
Closed

fix : replaced pickle.load with json and used context managers in Word-Building data.py#1846
tmdeveloper007 wants to merge 1 commit into
steam-bell-92:mainfrom
tmdeveloper007:#1841

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Summary of What Has Been Done

Replaced all pickle.load() and pickle.dump() calls in games/Word-Building/data.py with safe JSON-based serialization using json.load() and json.dump(). All file operations now use Python context managers (with statements) to ensure handles are properly closed even on exceptions.

Changes Made

  • Replaced import pickle with import json
  • Renamed words.bat to words.json to reflect the new JSON format
  • Replaced pickle.load(file) with json.load(file)
  • Replaced pickle.dump(words, file) with json.dump(words, file, ensure_ascii=False, indent=2)
  • Wrapped both read and write file operations in with context managers, eliminating manual file.close() calls
  • Added guard to prevent duplicate word entries in DataAdding

Impact it Made

  • Eliminates arbitrary code execution risk from pickle deserialization (CVE class vulnerability)
  • Prevents file handle leaks in error scenarios by using context managers
  • JSON format is human-readable for debugging and is language-agnostic

Closes #1841
Closes #1842

Note: Please assign this PR to the tmdeveloper007 account.

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@tmdeveloper007 is attempting to deploy a commit to the Anuj's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

fix : close file handles with context manager in Word-Building data.py fix : replace unsafe pickle.load with json in Word-Building data.py

2 participants