#1821: Carpet may call object methods with this == NULL ----------------------+----------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: new Priority: optional | Milestone: Component: Carpet | Version: development version Keywords: | ----------------------+----------------------------------------------------- see pull request https://bitbucket.org/eschnett/carpet/pull-requests/7 /carpet-avoid-using-null-pointer-for-member/diff
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: review Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+---------------------------------------------------- Changes (by rhaas):
* status: new => review
#1821: Carpet may call object methods with this == NULL -------------------------+-------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: closed Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: worksforme | Keywords: -------------------------+-------------------------------------------------- Changes (by rhaas):
* status: review => closed * resolution: => worksforme
Comment:
This is likely not worthwhile to address (if indeed it is a bug) unless we encounter a system where this breaks (with a SEGFAULT so it won't be a silent failure). See https://bitbucket.org/eschnett/carpet/pull-requests/7 /carpet-avoid-using-null-pointer-for-member/diff#comment-10904860
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: reopened Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+---------------------------------------------------- Changes (by rhaas):
* status: closed => reopened * resolution: worksforme =>
Comment:
Fails in CarpetPeriodic test testperiodicinterp. Related to #1986 which is however only a warning.
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: reopened Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by rhaas):
I re-opened #1821 which had the original proposed fix. I'll put the updated fix with only a single new_typed_data into the old pull request.
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: reopened Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by eschnett):
I now recall the correction I put into place. The fix is applied at the calling side (obviously). Instead of creating a temporary object, we're using another object that already exists at the caller, e.g. {{{src}}} instead of {{{dst}}}.
I thought this fix was already committed. Maybe I only applied it to a branch, or maybe I missed a calling site?
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: reopened Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by rhaas):
maybe, here's another way about it: https://bitbucket.org/eschnett/carpet /pull-requests/7/carpet-avoid-using-null-pointer-for-member/diff
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: reopened Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by eschnett):
(1) I don't think that CarpetLib itself calls this method, so the changes to {{{ggf.cc}}} should not be necessary. (2) In {{{PeriodicCarpet}}}, you could use {{{src}}} instead of {{{fake_data_pointer()}}}. (3) The initialization of the static variable in {{{fake_data_pointer}}} is not thread-safe. This has actually become an issue when using Qthreads for parallelization.
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: reopened Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by rhaas):
(1) I don't think that CarpetLib itself calls this method, so the
changes to {{{ggf.cc}}} should not be necessary.
I added a comment to the code diff: https://bitbucket.org/eschnett/carpet/pull-requests/7/carpet-avoid-using- null-pointer-for-member/diff#comment-33242870
(2) In {{{PeriodicCarpet}}}, you could use {{{src}}} instead of
{{{fake_data_pointer()}}}. Could be done. That seems odd though.
(3) The initialization of the static variable in {{{fake_data_pointer}}}
is not thread-safe. This has actually become an issue when using Qthreads for parallelization. Correct. At the time I reported this CarpetLib was not yet thread safe (ie none of the Timers was) so it did not matter. Thread safe would be either using new() or the src trick that you suggest or making transfer_from a static member function that takes the current dst as eg its first argument.
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: review Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+---------------------------------------------------- Changes (by rhaas):
* status: reopened => review
Comment:
I updated the pull request with a version that introduces static functions for gdata::copy_from and gdata::transfer_from and renames them to copy_data and transfer_data. This requires changes in all code using those functions since the originals are gone (could be restored but the current state brings attention to possible code parts that may also pass in a NULL this pointer).
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: review Priority: optional | Milestone: Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+----------------------------------------------------
Comment (by rhaas):
Erik: I think this should be reviewed before the next release as otherwise CarpetPeriodic fails to run when compiled with newer compilers (gcc 6.0 at least).
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: review Priority: optional | Milestone: ET_2017_05 Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+---------------------------------------------------- Changes (by rhaas):
* milestone: => ET_2017_05
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: reviewed_ok Priority: optional | Milestone: ET_2017_05 Component: Carpet | Version: development version Resolution: | Keywords: -----------------------+---------------------------------------------------- Changes (by eschnett):
* status: review => reviewed_ok
#1821: Carpet may call object methods with this == NULL -----------------------+---------------------------------------------------- Reporter: rhaas | Owner: eschnett Type: defect | Status: closed Priority: optional | Milestone: ET_2017_05 Component: Carpet | Version: development version Resolution: fixed | Keywords: -----------------------+---------------------------------------------------- Changes (by rhaas):
* status: reviewed_ok => closed * resolution: => fixed
Comment:
Thank you. Applied as git hash 474a09de0c1cd56c00492400fe5304c8e9591cbd "PeriodicCarpet: avoid using NULL this pointer for gdata::copy_from" of Carpet.
trac@lists.einsteintoolkit.org