You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Julian Hyde <jh...@apache.org> on 2016/09/08 18:54:13 UTC

Fwd: New Defects reported by Coverity Scan for Apache Calcite

MinJi,

Coverity discovered a potential issue due to your recent
https://issues.apache.org/jira/browse/CALCITE-1342 fix. Can you
investigate? If it's a real issue can you please fix and add a test
case.

Julian


---------- Forwarded message ----------
From:  <sc...@coverity.com>
Date: Thu, Sep 8, 2016 at 9:31 AM
Subject: New Defects reported by Coverity Scan for Apache Calcite
To: jhyde@apache.org



Hi,

Please find the latest report on new defect(s) introduced to Apache
Calcite found with Coverity Scan.

1 new defect(s) introduced to Apache Calcite found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 135803:  Null pointer dereferences  (FORWARD_NULL)
/core/src/main/java/org/apache/calcite/rel/rules/ProjectFilterTransposeRule.java:
95 in org.apache.calcite.rel.rules.ProjectFilterTransposeRule.onMatch(org.apache.calcite.plan.RelOptRuleCall)()


________________________________________________________________________________________________________
*** CID 135803:  Null pointer dereferences  (FORWARD_NULL)
/core/src/main/java/org/apache/calcite/rel/rules/ProjectFilterTransposeRule.java:
95 in org.apache.calcite.rel.rules.ProjectFilterTransposeRule.onMatch(org.apache.calcite.plan.RelOptRuleCall)()
89           // invocation; pushdown will be considered after the windowed
90           // aggregate has been implemented. It's OK if the filter contains a
91           // windowed aggregate.
92           return;
93         }
94
>>>     CID 135803:  Null pointer dereferences  (FORWARD_NULL)
>>>     Calling a method on null object "origProj".
95         PushProjector pushProjector =
96             new PushProjector(
97                 origProj, origFilter, rel, preserveExprCondition,
98                 relBuilderFactory.create(origProj.getCluster(), null));
99         RelNode topProject = pushProjector.convertProject(null);
100


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX1GSvKD3jyAHW-2Fr0-2Bf0CMC8B0U7suqxV3BT15z-2FEszmrI-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCtRS1jrIAa9vXyBPx3JAeWO-2B6FmYHvToF-2B2FQy0LKYYqo04RPryGC6-2Brk-2FCRmoc-2BZIlA5oPnubbdF77uAswgpCokObMbecgK1q2YHD-2BoM59maxKDVnCXpb84chqLjfdvdtcs0G4JiEOHDXWbkM49I4sd2FdrFcTwf7aTrwttuDGTQ-3D-3D

To manage Coverity Scan email notifications for "jhyde@apache.org",
click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4BoCAgQyGZbR5Ka-2BtqPkbMIRa0EKakQx2V3qCI3AQ17qSid0ChoOurTSf7RECs1gZeliKSiqSYFeQV5NHgws1sYYu5KfGgq-2FqD0AylqtLo7E-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCtRS1jrIAa9vXyBPx3JAeWOaaHqVdSKeJ3AGmvURiZE-2B6eWI82T4AhMExqOwIA9KTGp8X0-2BZeb8LeSR4dHW2MDWpAw9B6G-2BOF0GfHWen-2BluFTQcui6NRm8ZfUDxaSqcPl0573DHCQR0Gqku5eZ5D7lSUwZZ1Tq2cJc83YxyLeqQQA-3D-3D

Re: Fwd: New Defects reported by Coverity Scan for Apache Calcite

Posted by MinJi Kim <mi...@apache.org>.
Okay, I will take a look and send out an update later.


On 9/8/16 11:54 AM, Julian Hyde wrote:
> MinJi,
>
> Coverity discovered a potential issue due to your recent
> https://issues.apache.org/jira/browse/CALCITE-1342 fix. Can you
> investigate? If it's a real issue can you please fix and add a test
> case.
>
> Julian
>
>
> ---------- Forwarded message ----------
> From:  <sc...@coverity.com>
> Date: Thu, Sep 8, 2016 at 9:31 AM
> Subject: New Defects reported by Coverity Scan for Apache Calcite
> To: jhyde@apache.org
>
>
>
> Hi,
>
> Please find the latest report on new defect(s) introduced to Apache
> Calcite found with Coverity Scan.
>
> 1 new defect(s) introduced to Apache Calcite found with Coverity Scan.
>
>
> New defect(s) Reported-by: Coverity Scan
> Showing 1 of 1 defect(s)
>
>
> ** CID 135803:  Null pointer dereferences  (FORWARD_NULL)
> /core/src/main/java/org/apache/calcite/rel/rules/ProjectFilterTransposeRule.java:
> 95 in org.apache.calcite.rel.rules.ProjectFilterTransposeRule.onMatch(org.apache.calcite.plan.RelOptRuleCall)()
>
>
> ________________________________________________________________________________________________________
> *** CID 135803:  Null pointer dereferences  (FORWARD_NULL)
> /core/src/main/java/org/apache/calcite/rel/rules/ProjectFilterTransposeRule.java:
> 95 in org.apache.calcite.rel.rules.ProjectFilterTransposeRule.onMatch(org.apache.calcite.plan.RelOptRuleCall)()
> 89           // invocation; pushdown will be considered after the windowed
> 90           // aggregate has been implemented. It's OK if the filter contains a
> 91           // windowed aggregate.
> 92           return;
> 93         }
> 94
>>>>      CID 135803:  Null pointer dereferences  (FORWARD_NULL)
>>>>      Calling a method on null object "origProj".
> 95         PushProjector pushProjector =
> 96             new PushProjector(
> 97                 origProj, origFilter, rel, preserveExprCondition,
> 98                 relBuilderFactory.create(origProj.getCluster(), null));
> 99         RelNode topProject = pushProjector.convertProject(null);
> 100
>
>
> ________________________________________________________________________________________________________
> To view the defects in Coverity Scan visit,
> https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX1GSvKD3jyAHW-2Fr0-2Bf0CMC8B0U7suqxV3BT15z-2FEszmrI-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCtRS1jrIAa9vXyBPx3JAeWO-2B6FmYHvToF-2B2FQy0LKYYqo04RPryGC6-2Brk-2FCRmoc-2BZIlA5oPnubbdF77uAswgpCokObMbecgK1q2YHD-2BoM59maxKDVnCXpb84chqLjfdvdtcs0G4JiEOHDXWbkM49I4sd2FdrFcTwf7aTrwttuDGTQ-3D-3D
>
> To manage Coverity Scan email notifications for "jhyde@apache.org",
> click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4BoCAgQyGZbR5Ka-2BtqPkbMIRa0EKakQx2V3qCI3AQ17qSid0ChoOurTSf7RECs1gZeliKSiqSYFeQV5NHgws1sYYu5KfGgq-2FqD0AylqtLo7E-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCtRS1jrIAa9vXyBPx3JAeWOaaHqVdSKeJ3AGmvURiZE-2B6eWI82T4AhMExqOwIA9KTGp8X0-2BZeb8LeSR4dHW2MDWpAw9B6G-2BOF0GfHWen-2BluFTQcui6NRm8ZfUDxaSqcPl0573DHCQR0Gqku5eZ5D7lSUwZZ1Tq2cJc83YxyLeqQQA-3D-3D


Re: Fwd: New Defects reported by Coverity Scan for Apache Calcite

Posted by Vladimir Sitnikov <si...@gmail.com>.
Just in case, there's a new promising code analyzer:
https://github.com/amaembo/huntbugs

The procedure is rather simple:
1) checkout huntbugs, mvn install -DskipTests
2) cd to calcite
3) mvn one.util:huntbugs-maven-plugin:0.0.11-SNAPSHOT:huntbugs

What it does, it decompiles bytecode (via procyon), and performs the
analysis.

Here are sample issues identified on the calcite-core codebase:
https://github.com/apache/calcite/blob/857c06b6744840daac52f7a3ab7f6e0d32c90e41/core/src/main/java/org/apache/calcite/sql/fun/SqlMinMaxAggFunction.java#L112

The error is: The case 0: switch branch will never be executed, because
it's statically known that switch expression range is 1..1. Probably
there's some logic error or typo.
Basically, it figured out that minMaxKind is always equal
to MINMAX_COMPARABLE, so the switch is strange.

https://github.com/apache/calcite/blob/3ed625cf39c2671f57dbd0c73f27060169560269/core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java#L472

The error is "Possible null dereference in
SqlStdOperatorTable.1.inferReturnType().
The expression addUnit.ordinal() may fail with NullPointerException as
addUnit can be null at this location."

Vladimir

Re: Fwd: New Defects reported by Coverity Scan for Apache Calcite

Posted by MinJi Kim <mi...@apache.org>.
It looks like, in ProjectFilterTransposeRule, origProj can be null but 
that was also the case before the change.  And also, PushProject checks 
against null origProj.  It seems okay to me, but let me know if there is 
anything else I should do to verify this.  -MinJi


On 9/8/16 11:54 AM, Julian Hyde wrote:
> MinJi,
>
> Coverity discovered a potential issue due to your recent
> https://issues.apache.org/jira/browse/CALCITE-1342 fix. Can you
> investigate? If it's a real issue can you please fix and add a test
> case.
>
> Julian
>
>
> ---------- Forwarded message ----------
> From:  <sc...@coverity.com>
> Date: Thu, Sep 8, 2016 at 9:31 AM
> Subject: New Defects reported by Coverity Scan for Apache Calcite
> To: jhyde@apache.org
>
>
>
> Hi,
>
> Please find the latest report on new defect(s) introduced to Apache
> Calcite found with Coverity Scan.
>
> 1 new defect(s) introduced to Apache Calcite found with Coverity Scan.
>
>
> New defect(s) Reported-by: Coverity Scan
> Showing 1 of 1 defect(s)
>
>
> ** CID 135803:  Null pointer dereferences  (FORWARD_NULL)
> /core/src/main/java/org/apache/calcite/rel/rules/ProjectFilterTransposeRule.java:
> 95 in org.apache.calcite.rel.rules.ProjectFilterTransposeRule.onMatch(org.apache.calcite.plan.RelOptRuleCall)()
>
>
> ________________________________________________________________________________________________________
> *** CID 135803:  Null pointer dereferences  (FORWARD_NULL)
> /core/src/main/java/org/apache/calcite/rel/rules/ProjectFilterTransposeRule.java:
> 95 in org.apache.calcite.rel.rules.ProjectFilterTransposeRule.onMatch(org.apache.calcite.plan.RelOptRuleCall)()
> 89           // invocation; pushdown will be considered after the windowed
> 90           // aggregate has been implemented. It's OK if the filter contains a
> 91           // windowed aggregate.
> 92           return;
> 93         }
> 94
>>>>      CID 135803:  Null pointer dereferences  (FORWARD_NULL)
>>>>      Calling a method on null object "origProj".
> 95         PushProjector pushProjector =
> 96             new PushProjector(
> 97                 origProj, origFilter, rel, preserveExprCondition,
> 98                 relBuilderFactory.create(origProj.getCluster(), null));
> 99         RelNode topProject = pushProjector.convertProject(null);
> 100
>
>
> ________________________________________________________________________________________________________
> To view the defects in Coverity Scan visit,
> https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX1GSvKD3jyAHW-2Fr0-2Bf0CMC8B0U7suqxV3BT15z-2FEszmrI-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCtRS1jrIAa9vXyBPx3JAeWO-2B6FmYHvToF-2B2FQy0LKYYqo04RPryGC6-2Brk-2FCRmoc-2BZIlA5oPnubbdF77uAswgpCokObMbecgK1q2YHD-2BoM59maxKDVnCXpb84chqLjfdvdtcs0G4JiEOHDXWbkM49I4sd2FdrFcTwf7aTrwttuDGTQ-3D-3D
>
> To manage Coverity Scan email notifications for "jhyde@apache.org",
> click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4BoCAgQyGZbR5Ka-2BtqPkbMIRa0EKakQx2V3qCI3AQ17qSid0ChoOurTSf7RECs1gZeliKSiqSYFeQV5NHgws1sYYu5KfGgq-2FqD0AylqtLo7E-3D_imI2KYNsuEB01fwTN2GgVt7Zng1mYfKawcoWn3RVSCtRS1jrIAa9vXyBPx3JAeWOaaHqVdSKeJ3AGmvURiZE-2B6eWI82T4AhMExqOwIA9KTGp8X0-2BZeb8LeSR4dHW2MDWpAw9B6G-2BOF0GfHWen-2BluFTQcui6NRm8ZfUDxaSqcPl0573DHCQR0Gqku5eZ5D7lSUwZZ1Tq2cJc83YxyLeqQQA-3D-3D