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

r3.showdspf: fix null pointer dereference when opening database file #4245

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

ymdatta
Copy link
Contributor

@ymdatta ymdatta commented Aug 28, 2024

In the current execution, when we face an error while trying to open a database file, as part of error log we are dereferencing a NULL file pointer (which is returend when we try to open a file and error out). Ideally we should be printing the name of the database file rather than the file pointer. This fixes the problem of null pointer dereference.

This issue was found using cppcheck tool.

Output from cppcheck tool:

image

Output from cppcheck with the fix applied:

image
  1. Machine used: Virtual Machine running Ubuntu 22.04.4 LTS.
  2. Reproduction rate: 100%, reproducible every time.
  3. Architecture: Not specific to any underlying architecture.

In the current execution, when we face an error while trying
to open a database file, as part of error log we are dereferencing
a NULL file pointer (which is returend when we try to open a file).
Ideally we should be printing the name of the database file rather
than the file pointer. This fixes the problem of null pointer
dereference. Found via cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
@github-actions github-actions bot added C Related code is in C module raster3d labels Aug 28, 2024
@marisn marisn merged commit 3afa11d into OSGeo:main Aug 29, 2024
27 checks passed
ShubhamDesai pushed a commit to ShubhamDesai/grass that referenced this pull request Aug 29, 2024
…SGeo#4245)

r3.showdspf: fix null pointer dereference

In the current execution, when we face an error while trying
to open a database file, as part of error log we are dereferencing
a NULL file pointer (which is returend when we try to open a file).
Ideally we should be printing the name of the database file rather
than the file pointer. This fixes the problem of null pointer
dereference. Found via cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
@neteler neteler added this to the 8.5.0 milestone Aug 30, 2024
a0x8o pushed a commit to a0x8o/grass that referenced this pull request Sep 5, 2024
…SGeo#4245)

r3.showdspf: fix null pointer dereference

In the current execution, when we face an error while trying
to open a database file, as part of error log we are dereferencing
a NULL file pointer (which is returend when we try to open a file).
Ideally we should be printing the name of the database file rather
than the file pointer. This fixes the problem of null pointer
dereference. Found via cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
Mahesh1998 pushed a commit to Mahesh1998/grass that referenced this pull request Sep 19, 2024
…SGeo#4245)

r3.showdspf: fix null pointer dereference

In the current execution, when we face an error while trying
to open a database file, as part of error log we are dereferencing
a NULL file pointer (which is returend when we try to open a file).
Ideally we should be printing the name of the database file rather
than the file pointer. This fixes the problem of null pointer
dereference. Found via cppcheck tool.

Signed-off-by: Mohan Yelugoti <ymdatta.work@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C module raster3d
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants