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

Catch zero-length PVs #2199

Open
kasemir opened this issue Apr 27, 2017 · 3 comments
Open

Catch zero-length PVs #2199

kasemir opened this issue Apr 27, 2017 · 3 comments
Assignees

Comments

@kasemir
Copy link
Contributor

kasemir commented Apr 27, 2017

vtype.pv should throw exception for zero-length PV name requests because they might crash the CA gateway, http://www.aps.anl.gov/epics/tech-talk/2017/msg00714.php

@kasemir kasemir self-assigned this Apr 27, 2017
kasemir added a commit that referenced this issue Apr 27, 2017
@kasemir
Copy link
Contributor Author

kasemir commented Apr 27, 2017

vtype.pv no longer passes zero-length PV names on to JCA.

Found that the EPICS PV Tree would request empty PV when no PV name is entered.
More tools requesting empty PVs will now be caught because of vtype.pv update.

@anjohnson
Copy link

The underlying caj client library should be catching empty PV names itself and not passing them on, but evidently it doesn't. The libCa implementation returns ECA_BADSTR from ca_create_channel() when handed an empty PV name, so C-based clients can't cause this problem.

@kasemir
Copy link
Contributor Author

kasemir commented Apr 28, 2017

Agree that CAJ should also catch empty PV names, for example

diff -r 4e82abf3d65b src/com/cosylab/epics/caj/CAJChannel.java
--- a/src/com/cosylab/epics/caj/CAJChannel.java	Mon Jun 29 21:01:06 2015 +0200
+++ b/src/com/cosylab/epics/caj/CAJChannel.java	Fri Apr 28 09:22:53 2017 -0400
@@ -186,6 +186,8 @@
	protected CAJChannel(CAJContext context, int channelID, String name,
			ConnectionListener listener, short priority) throws CAException
	{
+		if (name == null  ||  name.isEmpty())
+			throw new CAException("Empty channel name");
		this.context = context;
		this.channelID = channelID;
		this.name = name;

Contacted Matej.

@berryma4 berryma4 added this to the 4.5.0 - testing (master) milestone Sep 5, 2017
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

No branches or pull requests

3 participants